当远程登录mysql时,提示 Access denied for user 'root'@'localhost' (using password: YES),这说明root账号没有开放远程访问权限。
解决步骤:
1、直接修改配置文件(my.cnf)
在最后一行添加 skip-grant-tables
注:如果找不文件,可以通过
mysql --help | grep my.cnf 命令查找文件
2、重启mysql(service mysqld restart)
3、登录mysql
mysql -u root -p 回车输入密码
4、use mysql (使用mysql数据库)
5、修改root用户的密码 update user set password=PASSWORD("123456") where user='root';
6、去掉配置文件(my.cnf)刚才添加的 skip-grant-tables 重启mysql(service mysqld restart)