标签:重启 数据库 star ble let 相关 stop com int
在网上查了一下相关的案例,发现与权限表mysql.user表有关
解决方法:
关闭数据库
service mysqld stop
以跳过权限认证方式启动mysql
mysqld_safe --defaults-file=/etc/my.cnf --skip-grant-tables &
删除mysql.user表中host名为‘localhost‘的记录
mysql> use mysql
mysql> delete from user where host=‘localhost‘;
Query OK, 7 rows affected (0.00 sec)
mysql> INSERT INTO `user` VALUES (‘localhost‘,‘root‘,‘‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘,‘Y‘, ‘Y‘, ‘‘,‘‘,‘‘,‘‘,0,0,0,0);
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
再次重启数据库后,正常
service mysqld restart
mysqld_safe --defaults-file=/etc/my.cnf &
更改root密码
mysqladmin -u root -proot password
mysql 执行show databases没有mysql库
标签:重启 数据库 star ble let 相关 stop com int
原文地址:https://www.cnblogs.com/mnote/p/8994983.html