Mysql 5 7 遠端連線出錯

2022-07-28 09:00:16 字數 1829 閱讀 8431

centos7 上安裝mysql5.7後登入報錯error 1045 (28000): access denied for user 'root'@'localhost' (using pas

安裝完mysql後會有個臨時密碼去日誌檢視,但是檢視登入修改密後還是不行

error 1045 (28000): access denied for user 'root'@'localhost' (using password:yes)

於是1,停止mysql服務

systemctl stop mysqld.service
2,修改配置檔案無密碼登入

[html]view plain

copy

vi /etc/my.cnf 

在最尾部加上

[html]view plain

copy

skip-grant-tables 

儲存3,啟動mysql

[html]view plain

copy

systemctl start mysqld.service 

4,登入musql

[html]view plain

copy

mysql -u root 

此處注意不要加-p

5,修改密碼,mysql5.7用此語法

[html]view plain

copy

use mysql ; 

[html]view plain

copy

update mysql.user set authentication_string=password('123456') where user='root' ; 

6,回到第二步驟去掉加上的

[html]view plain

copy

skip-grant-tables 

儲存 重啟mysql就ok了

其實預設安裝完了mysql後或在日誌中生成乙個預設的密碼 /var/log/mysqld.log 中

拿到預設密碼後登入mysql  進行密碼重新設定

[html]view plain

copy

set passwprd=password('you password'); 

如果密碼級別與預設的級別要求不符時候會報

[html]view plain

copy

your password does not satisfy the current policy requirements 

此時需要修改級別與最小的預設密碼位數

[html]view plain

copy

set global validate_password_policy=0; 

set global validate_password_length=4; 

然後在進行設定密碼就好了

遠端連線時1130錯誤

[html]view plain

copy

mysql;use mysql;   

mysql;select 'host' from user where user='root';   

mysql;update user set host = '%' where user ='root';   

mysql;flush privileges;   

mysql;select 'host'   from user where user='root'; 

設定mysql5 7遠端連線

在ubuntu14.04上安裝好mysql5.7之後,本地可以連線mysql伺服器。遠端就不行。注釋掉在 etc mysql mysql.conf.d mysqld.cnf裡面的bind address 127.0.0.1 by default we only accept connections ...

Mysql 5 7 開啟遠端連線

centos系統安裝好mysql後,預設情況下不支援使用者通過非本機連線上資料庫伺服器,下面是解決方法 1 在控制台執行 mysql uroot p系統提示輸入資料庫root使用者的密碼,輸入完成後即進入mysql控制台 2 選擇資料庫 use mysql 開啟遠端連線 root 使用者名稱 所有人...

Mysql 5 7 開啟遠端連線

在ubuntu14.04上安裝好mysql5.7之後,本地可以連線mysql伺服器。遠端就不行。注釋掉在 etc mysql mysql.conf.d mysqld.cnf裡面的bind address 127.0.0.1 by default we only accept connections ...