赞
踩
[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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。