Mysql 無法登入問題
問題如下 Access denied for user 'root'@'localhost' (using password: NO) 解決方式: 1.service mysqld stop 2.mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 3.mysql -uroot mysql 4.UPDATE user SET Password=PASSWORD('輸入你 root 的新密碼') where USER='root'; 5.FLUSH PRIVILEGES; 6.GRANT all ON *.* TO root@'localhost' IDENTIFIED BY '輸入你 root 的密碼'; 7.FLUSH PRIVILEGES; 8.service mysqld restart 萬一出現密碼強度太低的警告,請服用降低密碼安全性後再次設定密碼 set global validate_password_policy=0; mysql5.7以上,第四步驟請使用 update user set authentication_string=password('password') where user='root'; centos7以上 vim /etc/my.cnf 在其配置文件/etc/my.cnf中加入skip-grant-tables=1即可