ERROR 1044 (42000):Access denied for user ''@'localhost'_MySQL
程序员文章站
2022-05-25 13:41:59
...
bitsCN.com
ERROR 1044 (42000):Access denied for user ''@'localhost' to database 'mysql'的解决方法 提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'。前两天也出现过这个问题,网上找了一个比较流行的方法(见方法一),搞定了。今天又用这个试了试,却搞不定,在网上找了半天,终于发现是因为mysql数据库的user表里,存在用户名为空的账户即匿名账户,导致登录的时候是虽然用的是root,但实际是匿名登录的,通过错误提示里的''@'localhost'可以看出来,于是解决办法见方法二。 方法一:1.关闭mysql # service mysqld stop2.屏蔽权限 # mysqld_safe --skip-grant-table 屏幕出现: Starting demo from ..... 3.新开起一个终端输入 # mysql -u root mysql mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误 mysql> /q 方法二:1.关闭mysql # service mysqld stop2.屏蔽权限 # mysqld_safe --skip-grant-table 屏幕出现: Starting demo from ..... 3.新开起一个终端输入 # mysql -u root mysql mysql> delete from user where USER=''; mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误 mysql> /q
bitsCN.com
ERROR 1044 (42000):Access denied for user ''@'localhost' to database 'mysql'的解决方法 提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'。前两天也出现过这个问题,网上找了一个比较流行的方法(见方法一),搞定了。今天又用这个试了试,却搞不定,在网上找了半天,终于发现是因为mysql数据库的user表里,存在用户名为空的账户即匿名账户,导致登录的时候是虽然用的是root,但实际是匿名登录的,通过错误提示里的''@'localhost'可以看出来,于是解决办法见方法二。 方法一:1.关闭mysql # service mysqld stop2.屏蔽权限 # mysqld_safe --skip-grant-table 屏幕出现: Starting demo from ..... 3.新开起一个终端输入 # mysql -u root mysql mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误 mysql> /q 方法二:1.关闭mysql # service mysqld stop2.屏蔽权限 # mysqld_safe --skip-grant-table 屏幕出现: Starting demo from ..... 3.新开起一个终端输入 # mysql -u root mysql mysql> delete from user where USER=''; mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误 mysql> /q
bitsCN.com
推荐阅读
-
MySQL密码正确却无法本地登录-1045 Access denied for user 'root'@'localhost' (using password:YES
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using passwor
-
java访问数据库被拒绝,不能连接数据库ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
-
ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: YES)实用解决方案
-
提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'的错误如何解决?
-
ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
-
Access denied for user 'root'@'localhost' (using password:YES) Mysql5.7
-
转载--MYSQL5.7:Access denied for user 'root'@'localhost' (using pa