解决centos7.4 安装LAMP环境后报错:1130- Host xxx is not allowed to……
配置好环境后,用navicat登录账号时报1130- Host xxx is not allowed to……或 access denied for user root@……错,原因是远程登录权限需要再设置一下,流程如下:
1.登录shell工具,先登录mysql(最新的mysql分支为mariaDB)mysql -uroot -p 回车 输入密码 回车确定登录。
2.在mysql中运行命令
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '密码' WITH GRANT OPTION;
或者grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
然后
flush privileges;
3.exit后重启, 现在查看能否登录,这类错误基本是权限问题
公司的一个服务器过段时间就会出现mysql拒绝服务的情况,报错提示
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
mysql隔几天就自动停止一次,启动命令:
/etc/init.d/mysqld start
正在寻找解决办法