当前位置:   article > 正文

var lib mysql files_安装mysql5.5.20遇到cannot create directory `/var/lib/mysql': Permission denied...

chown: cannot access ‘/var/lib/mysql’: no such file or directory

[lamp@localhost mysql5.5]$ scripts/mysql_install_db --user=lamp

mkdir: cannot create directory `/var/lib/mysql': Permission denied

chmod: cannot access `/var/lib/mysql': No such file or directory

chown: cannot access `/var/lib/mysql': No such file or directory

Cannot change ownership of the database directories to the 'lamp'

user.  Check that you have the necessary permissions and try again.

在linux 系统中mysql配置文件的读取顺序为:/etc/my.cnf   /etc/mysql/my.cnf    /usr/local/mysql/etc/my.cnf     ~/.my.cnf

估计是优先读取/etc/my.cnf导致的,切换到root用户查看/etc/my.cnf .果然datadir定义的路径和前面报错的路径是一致的。

[root@localhost etc]# more  /etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

注释掉这个文件,把/etc/my.cnf改个名

[root@localhost etc]# mv my.cnf my.cnf_bak

重新安装默认的mysql数据库,一切正常

[lamp@localhost mysql5.5]$ scripts/mysql_install_db --user=lamp

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/89482
推荐阅读
相关标签
  

闽ICP备14008679号