博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL源码安装完成后修改安装路径启动问题
阅读量:6859 次
发布时间:2019-06-26

本文共 2118 字,大约阅读时间需要 7 分钟。

在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就可以无碍使用了。

本文转自 yubowei 51CTO博客,原文链接:http://blog.51cto.com/samyubw/552477

转载地址:http://nrxyl.baihongyu.com/

你可能感兴趣的文章
matplotlib.pyplot.plot()参数详解
查看>>
||PHP||关于=>和->以及::的用法
查看>>
最短路径问题
查看>>
Yii2中定义自己的Widget
查看>>
Aforge.net识别简易数字验证码问题
查看>>
JVM系列二:GC策略&内存申请、对象衰老
查看>>
MySQL 数据库备份策略:全备与增量备份
查看>>
Springboot的热部署
查看>>
Thinking in UML-1-为什么需要UML
查看>>
vs编译obj给delphi用
查看>>
过游戏保护NP或TP的几种方法和思路
查看>>
equals和hashcode为什么要一起重写
查看>>
模态与非模态对话框的问题
查看>>
地对地导弹地对地导弹地对地导弹
查看>>
让div 充满整个body
查看>>
程序员保持快乐活跃的6个好习惯(转)
查看>>
找工作的一些感悟——前端小菜的成长
查看>>
jSON Call can throw but it is not marked with try
查看>>
用过的一些服务器集成软件
查看>>
一键拨打
查看>>