解决Linux下MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor)问题
两种方案:
一:
1.修改mysql配置文件:vim /etc/my.cnf
2.找到[mysqld]下添加 skip-grant-tables 配置
3.重启服务service mysqld restart
二:
通过安装mysql默认密码来进行登陆,输入 cat /var/log/mysqld.log | grep "temporary password" 获取到默认密码,再进行登陆修改密码(不修改的话会提示"ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement")。
1: SET PASSWORD = PASSWORD('newpassword');
2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
3: flush privileges;
除了红色newpassword自己设置以外其他的正常输出就行。