Home >Database >Mysql Tutorial >ERROR 1044 (42000): Access denied for user ”@’loca

ERROR 1044 (42000): Access denied for user ”@’loca

WBOY
WBOYOriginal
2016-06-07 16:41:511062browse

最开始数据库密码为空,后来改过一次密码的加密写成了md5加密,退出后,空密码登陆没有mysql表,输入md5的密码登陆不进去,这时需要匿名登录。 1.关闭mysql # service mysqld stop 2.屏蔽权限 # mysqld_safe --skip-grant-table 第二步回车之后,会出现两行

最开始数据库密码为空,后来改过一次密码的加密写成了md5加密,退出后,空密码登陆没有mysql表,输入md5的密码登陆不进去,这时需要匿名登录。

1.关闭mysql

# service mysqld stop

2.屏蔽权限

# mysqld_safe --skip-grant-table

第二步回车之后,会出现两行,其中有Starting demo from ******,这时需要新开一个窗口进行数据库的登陆操作。

3.新开起一个终端输入

# mysql -u root mysql
# mysql> UPDATE user SET Password=PASSWORD('1234567') where USER='root';
# mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
# mysql> \q

ok,新密码设置成功

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn