登录mysql报1045错处理方法

2020-03-26 23:04

命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解决方法

1、停用mysql服务:# /etc/rc.d/init.d/mysqld stop

2、输入命令:# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

3、登入数据库:# mysql -u root mysql

4、mysql> use mysql;结果如下: Database changed ;

5、显示MySQL所有用户:selecthost,user,password from user;

6、添加 MySQL 用户(user name:user1,password:sql): grant all on *.* to user1@'%' identified by 'sql' with grant option;

7、mysql> UPDATE user SET Password=PASSWORD('newpassword')where USER='newuser'; 结果如下: Query OK, 3 rows affected (0.00 sec)

Rows matched: 3 Changed: 3 Warnings: 0

mysql>FLUSH PRIVILEGES; 结果如下: Query OK, 0 rows affected (0.00 sec)

mysql> quit

# /etc/init.d/mysql restart

# mysql -u newuser–p Enter password:newpassword mysql><登录成功>

显示MySQL所有用户: usemysql;

selecthost,user,password from user;

添加 MySQL 用户(user name:user1,password:sql):

grant all on *.* to user1@'%' identified by 'sql' with grant option;


登录mysql报1045错处理方法.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:《民用建筑设计通则》

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: