After mysql is compiled and installed in the Linux source code, the installation path is modified. However, an error is reported after the environment variable is set, as follows:
[Root@www.bkjia.com var] # mysqld_safe -- user = mysql &
[1] 31248
[Root@www.bkjia.com var] #110422 11:04:00 mysqld_safe Logging to '/opt/mysql5156/var/hserver_03.err '.
Touch: cannot touch '/opt/mysql5156/var/hserver_03.err': No such file or directory
Chown: cannot access'/opt/mysql5156/var/HServer_03.err ': No such file or directory
110422 11:04:00 mysqld_safe The file/opt/mysql5156/libexec/mysqld
Does not exist or is not executable. Please cd to the mysql installation
Directory and restart this script from there as follows:
./Bin/mysqld_safe &
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information
/Usr/local/mysql/bin/mysqld_safe: line 100:/opt/mysql5156/var/HServer_03.err: No such file or directory
[1] + Exit 1 mysqld_safe -- user = mysql
Follow the prompts that the original path directory does not exist and you need to start it in the relative path of mysql ~
My original installation path is under/opt/mysql5156. The specific installation process is as follows:
Shell & gt; tar-zxvvf mysql-5.1.56.tar.gz
Shell & gt; cd mysql-5.1.56
Shell & gt;./configure -- prefix =/opt/mysql5156 \
-- With-charset = utf8 -- with-collation = utf8_general_ci \
-- With-extra-charsets = latin1, gb2312 \
-- With-plugins = innobase, innodb_plugin, myisam, heap, csv, federated, blackhole \
-- Enable-local-infile -- enable-thread-safe-client
Shell & gt; make
Shell & gt; make install
Shell & gt; cp support-files/my-medium.cnf/etc/my. cnf
Shell & gt; cd/opt/mysql5156
Shell & gt; chown-R mysql.
Shell & gt; chgrp-R mysql.
Shell & gt; bin/mysql_install_db-user = mysql
Shell & gt; chown-R root.
Shell & gt; chown-R mysql var
Shell & gt; vi/root/. bash_profile
PATH = $ PATH: $ HOME/bin:/opt/mysql5156/bin
Now move the/opt/mysql5156/directory to/usr/local:
Shell & gt; mv/opt/mysql5156/usr/local/mysql
Shell & gt; vi/root/. bash_profile
PATH = $ PATH: $ HOME/bin:/usr/local/mysql/bin
Shell & gt; source/root/. bash_profile
The main cause of the above error at startup is that mysql writes the path/opt/mysql5156 to the mysql/bin/mysqld_safe script during compilation and installation, open this script and you will see that the judgment of each startup logic has the shadow of/opt/mysql5156. Then, replace all/opt/mysql5156 with/usr/local/mysql globally, save and restart. OK.
In addition, because dynamic compilation is used in this compilation and installation, you also need to modify the mysql dynamic library,
Shell & gt; vi/etc/ld. so. conf
/Usr/local/mysql/lib/mysql/
Shell & gt; ldconfig
In this way, mysql compiled and installed can be used in the new path.