基于mysql创建库的报错解决小记mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database

时间:2022-08-13 19:22:12

 

mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database异常处理

1、找到find / -name my.cnf这个文件修改[mysqld]字段增加skip-grant-tables

2、启动mysql

3、mysql语句执行:

a、use mysql;

b、  update user set password=password('123456') WHERE User='root';

c、flush privileges;

4、重启mysqld即可