mysql数据库错误之Access denied for user ''@'localhost' to database

时间:2021-10-30 00:35:28

mysql数据库错误之Access denied for user ''@'localhost' to database
后来发现问题是:用户表多了个匿名用户,同时 localhost 少了个字母l;

最后不允许匿名登录,执行以下语句
mysql> delete from user where user=”;
mysql > flush privileges;
mysql> \q
重启:service mysqld restart

注意:以后尽量少用高权限的用户登录并操作数据库