MySQL登录 ERROR 1045 (28000) Access denied for user 'root'@'localhost' (using password NO)问题
2018-03-28 10:45
866 查看
一、问题今天在CentOS安装了mysql,由于mysql刚刚安装完的时候,mysql的root用户的密码默认是空的,所以我使用命令mysql -uroot或mysql登录mysql,但是出现了如下错误:
ERROR 1045(28000): Access denied for user 'root'@'localhost' (using password: NO)
二、解决方法
1. 停止mysql数据库:systemctl stop mysqld
2. 用以下命令启动MySQL,以不检查权限的方式启动:
mysqld --skip-grant-tables &此时可能会报另一个错误:2018-02-01T02:52:55.093724Z 0 [ERROR] Fatal error: Please read"Security" section of the manual to find out how to run mysqld asroot!
执行命令:mysqld--user=root --skip-grant-tables &
3. 登录mysql:mysql -uroot或mysql
4. 更新root密码
mysql5.7以下版本:
UPDATE mysql.user SETPassword=PASSWORD('123456') where uSER='root';mysql5.7版本:UPDATE mysql.userSET authentication_string=PASSWORD('123456') where USER='root'5. 刷新权限:flush privileges;6. 退出mysql:exit或quit7. 使用root用户重新登录mysqlmysql-uroot –pEnterpassword:<输入新设的密码123456>
ERROR 1045(28000): Access denied for user 'root'@'localhost' (using password: NO)
二、解决方法
1. 停止mysql数据库:systemctl stop mysqld
2. 用以下命令启动MySQL,以不检查权限的方式启动:
mysqld --skip-grant-tables &此时可能会报另一个错误:2018-02-01T02:52:55.093724Z 0 [ERROR] Fatal error: Please read"Security" section of the manual to find out how to run mysqld asroot!
执行命令:mysqld--user=root --skip-grant-tables &
3. 登录mysql:mysql -uroot或mysql
4. 更新root密码
mysql5.7以下版本:
UPDATE mysql.user SETPassword=PASSWORD('123456') where uSER='root';mysql5.7版本:UPDATE mysql.userSET authentication_string=PASSWORD('123456') where USER='root'5. 刷新权限:flush privileges;6. 退出mysql:exit或quit7. 使用root用户重新登录mysqlmysql-uroot –pEnterpassword:<输入新设的密码123456>
相关文章推荐
- 解决MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)问题
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- 解决MySql登录错误ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql问题ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- CentOS 命令登录MySQL时,报错 ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO))
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- mysql登录账号出错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)