MySQL源码安装完成后修改安装路径启动问题
2011-04-24 15:50
676 查看
在Linux上源码编译安装完mysql后,又将安装的路径进行了修改,但是发现在设置后环境变量后启动报错,如下:
[root@HServer_03 var]# mysqld_safe --user=mysql &
[1] 31248
[root@HServer_03 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
按照提示原有的路径目录不存在,需要到mysql的相对路径下启动~
我的原安装路径是在/opt/mysql5156下,具体的安装过程:
Shell> tar –zxvvf mysql-5.1.56.tar.gz
Shell> cd mysql-5.1.56
Shell> ./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> make
Shell >make install
Shell> cp support-files/my-medium.cnf /etc/my.cnf
Shell>cd /opt/mysql5156
Shell>chown –R mysql .
Shell>chgrp –R mysql .
Shell>bin/mysql_install_db –user=mysql
Shell>chown –R root .
Shell> chown –R mysql var
Shell>vi /root/.bash_profile
PATH=$PATH:$HOME/bin:/opt/mysql5156/bin
现在将/opt/mysql5156/目录移动到/usr/local/下:
Shell>mv /opt/mysql5156 /usr/local/mysql
Shell>vi /root/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
Shell>source /root/.bash_profile
在启动时出现上述错误的主要原因是mysql在编译安装时,将路径/opt/mysql5156写入了mysql/bin/mysqld_safe脚本中,打开该脚本可以明确看到各个启动逻辑的判断都有/opt/mysql5156的影子,那么将所有的/opt/mysql5156 全局替换为/usr/local/mysql,保存后重新启动,ok了。
另外由于这次的编译安装时采用动态编译的,还需要修改mysql的动态函式库,
Shell>vi /etc/ld.so.conf
/usr/local/mysql/lib/mysql/
Shell>ldconfig
这样在新的路径下,编译安装的mysql就可以无碍使用了。
[root@HServer_03 var]# mysqld_safe --user=mysql &
[1] 31248
[root@HServer_03 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
按照提示原有的路径目录不存在,需要到mysql的相对路径下启动~
我的原安装路径是在/opt/mysql5156下,具体的安装过程:
Shell> tar –zxvvf mysql-5.1.56.tar.gz
Shell> cd mysql-5.1.56
Shell> ./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> make
Shell >make install
Shell> cp support-files/my-medium.cnf /etc/my.cnf
Shell>cd /opt/mysql5156
Shell>chown –R mysql .
Shell>chgrp –R mysql .
Shell>bin/mysql_install_db –user=mysql
Shell>chown –R root .
Shell> chown –R mysql var
Shell>vi /root/.bash_profile
PATH=$PATH:$HOME/bin:/opt/mysql5156/bin
现在将/opt/mysql5156/目录移动到/usr/local/下:
Shell>mv /opt/mysql5156 /usr/local/mysql
Shell>vi /root/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
Shell>source /root/.bash_profile
在启动时出现上述错误的主要原因是mysql在编译安装时,将路径/opt/mysql5156写入了mysql/bin/mysqld_safe脚本中,打开该脚本可以明确看到各个启动逻辑的判断都有/opt/mysql5156的影子,那么将所有的/opt/mysql5156 全局替换为/usr/local/mysql,保存后重新启动,ok了。
另外由于这次的编译安装时采用动态编译的,还需要修改mysql的动态函式库,
Shell>vi /etc/ld.so.conf
/usr/local/mysql/lib/mysql/
Shell>ldconfig
这样在新的路径下,编译安装的mysql就可以无碍使用了。
相关文章推荐
- mysql二进制非root用户安装后启动mysqld的路径不对的问题
- MySQL安装与配置 -- 压缩包版本及解决服务不启动、修改密码的问题
- 源码编译安装 PHP5.5.0,解决curl_exec访问HTTPS返回502错误的问题(修改PATH路径)
- MySQL服务在windows系统中修改Data路径后无法启动问题解决
- MySQL在windows系统中修改datadir路径后无法启动问题,报错1067
- 关于被安装到sdcard,无法接受到系统启动事件的问题, 修改安装路径
- mysql 5.6.22 修改安装路径问题
- 关于Wampserver安装完成后无法启动MySQL的问题
- MySql安装完成之后的启动问题
- 安装xampp过程中启动mysql“卡住”问题解决办法
- 安装widows mysql 免安装版(zip) 步骤详解 以及遇到问题解决 以及忘记密码的修改方法
- mysql的my.ini文件被修改,无法启动问题,错误编号1067
- 使用阿里云云服务器Ubuntu14.0.4系统安装mysql修改默认编码导致mysqld.sock消失的问题
- Mysql-5.7.11-win64位安装--Mysql服务无法启动的问题
- DI v6.2,将dimanager.war在WAS 8.0上安装完成后在根目录下会生成 _work_dimanager_6200 这样的文件夹,如何修改这个文件夹生成的路径?
- Yum安装MySQL以及相关目录路径和修改目录
- centos7中源码安装mysql过程及遇到的问题
- 【MySQL源码】源码安装和启动mysql
- Centos7 上安装mysql遇上的问题:mysql无法正常启动
- ThinkPHP框架搭建及常见问题(XAMPP安装失败、Apache/MySQL启动失败)