close

ubuntu 18.04.02在剛灌好MySQL(5.7)時因為權限設定的很嚴謹,導致了剛灌完就進不去的窘境

 

解法手順:

 

1.先修改mysql設定檔,加入跳過檢查的設定

$sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]
skip-grant-tables

 

2.重新啟動mysql

$sudo /etc/init.d/mysql restart

 

3.進入mysql修改權限

$mysql -uroot
> use mysql;
> UPDATE user SET authentication_string=PASSWORD("") WHERE User='root';
> UPDATE user SET plugin="mysql_native_password" WHERE User='root';  

 

4.把第一步的修改回復並再度重新啟動,應該就可以正常登入了

 

5.假如有習慣用遠端登入的話

> ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_password'; 
> GRANT ALL PRIVILEGES ON *.* TO 'root'@'your_ip' IDENTIFIED BY 'your_password';
> FLUSH PRIVILEGES;

arrow
arrow
    文章標籤
    mysql
    全站熱搜

    不來嗯 發表在 痞客邦 留言(0) 人氣()