问题:在linux 上安装了mysql服务端,使用客户端连接时报错信息为:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
解决方法1:
1.登录mysql: mysql -uroot -proot
2.授权:GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
3.刷新权限:FLUSH PRIVILEGES;
4.退出:EXIT
解决方法2:
1. 登录mysql: mysql -uroot -proot
2. 选择mysql数据库:use mysql;
3. 修改访问权限:update user set host = ‘%‘ where user = ‘root‘;
4. 刷新权限:FLUSH PRIVILEGES;
5. 退出:EXIT
时间: 2024-10-10 11:02:26