- 远程登录授权:
- GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%'IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
- 授权admin 用户使用admin密码登录,任何ip都可以使用admin进行远程登录。 youpassword是远程机器192.168.32.21登录mysql的密码,可以自行设置。
- GRANT ALL PRIVILEGES ON *.* TO 'admin'@'192.168.32.21' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
- 授权远程ip为192.168.32.21 可以远程登录,登录账号admin,密码 youpassword。
- flush privileges;
- 执行刷新,即可。
-
MySQLAccess denied for user 'root'@'localhost' 登录失败问题解决
- 在etc/my.cnf 里添加如下:然后重启mysql,使用# mysql直接登录,登录后修改
[mysqld]
skip-grant-tables
- root密码: update user set authentication_string=password('youpassword') where user='root' ;
- flush privileges;
- quit 退出;
- 然后重启mysql,注释掉 # skip-grant-tables
- 再次使用mysql -u root -p
- 登录。
- 登录后进行授权操作即可