使用lnmp1.7快速搭建的集成环境,在访问自带的phpmyadmin时提示:
mysqli_real_connect(): (HY000/2002): No such file or directory
在/etc/my.conf中修改host为127.0.0.1,无效
重新启动mysql,报错:
Starting MySQL... ERROR! The server quit without updating PID file (/usr/local/mysql/var/host1.pid).
查看host1.err文件,发现有类似如下错误:
Table 'mysql.plugin' doesn't exist
...
Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
...
Table 'mysql.servers' doesn't exist.
提示执行mysql_upgrade命令创建,但如果你执行mysql_upgrade时报错,会提示如下错误:
Error: Failed while fetching Server version! Could be due to unauthorized access.
这其实在mysql安装时一些关键信息没有创建成功,需要使用mysql_install_db命令重建,使用如下命令:
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var &
以上注意datadir目录要是my.conf中配置的目录!网上有些教程中这里写的是/usr/local/mysql/data/ 。
执行成功后,重新启动mysql(lnmp start mysql)成功。
启动后可能需要重置mysql root密码,使用:
/usr/local/mysql/bin/mysqladmin -u root password '你的新密码'
(注意mysqladmin路径,你的或许不在这个目录,可以看看/usr/bin/)
本文链接:https://my.lmcjl.com/post/22.html
展开阅读全文
4 评论