mysql-error1045

全文约98字 1分钟阅读

本地连接远程数据库报错,类似于

error no. 1045 access denied for user 'root'@'*****' (using password:YES)。

mysql -u root -p    #  数据库登录,输入密码
use mysql;          #  切换
 
select  User,authentication_string,Host from user;  # 获取用户信息

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password'; #  添加新用户
flush privileges;    # 重新加载权限数据

select  User,authentication_string,Host from user; # 再次查看