MySQL源码安装完成后修改安装路径启动问题
在Linux上源码编译安装完mysql后,又将安装的路径进行了修改,但是发现在设置后环境变量后启动报错,如下:[root@www.linuxidc.c
在Linux上源码编译安装完mysql后,又将安装的路径进行了修改,但是发现在设置后环境变量后启动报错,如下:
[root@ var]# mysqld_safe --user=mysql &
[1] 31248
[root@ 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 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就可以无碍使用了。
上一篇: 关于get获取数据,该如何处理
推荐阅读
-
MySQL源码安装完成后修改安装路径启动问题
-
Fedora 18 安装完MySQL 无法启动问题
-
解决MySQL8.0安装第一次登陆修改密码时出现的问题
-
mysql二进制非root用户安装后启动mysqld的路径不对的问题_MySQL
-
Linux MySQL使用rpm安装的后的路径问题
-
ThinkPHP框架搭建及常见问题(XAMPP安装失败、Apache/MySQL启动失败),thinkphpxampp
-
mysql-Linux安装MySQL 使用普通用户启动问题
-
ThinkPHP框架搭建及常见问题(XAMPP安装失败、Apache/MySQL启动失败)_PHP
-
ThinkPHP框架搭建及常见问题(XAMPP安装失败、Apache/MySQL启动失败)
-
mysql-8.0.15-winx64 使用zip包进行安装及服务启动后立即关闭问题