日常 解決mysql不允許外部訪問

2022-01-30 18:40:34 字數 776 閱讀 3162

1.在埠已經開放的情況下,ubuntu mysql 3306允許遠端訪問

vim /etc/mysql/mysql.conf.d/mysqld.cnf

注釋#bind-address = 127.0.0.1

2.給使用者授權允許遠端訪問:

grant all privileges on *.* to root@"%" identified by "pwd" with grant option;

flush privileges;

建立和授權使用者某些許可權的測試,在mysql資料庫的user表裡進行的操作

1.mysql建立使用者:

create user 'taoshihan'@'localhost' identified by '';

localhost是只是本地

%是允許遠端

create user 'taoshihan115'@'%' identified by 'taoshihan1';

刪除使用者:

drop user 'taoshihan'@'localhost'

2.授權:

grant select on *.* to 'taoshihan115'@'%';授權指定

grant all on *.* to 'taoshihan115'@'%';授權所有

當mysql重啟不了的時候,看看日誌目錄比如/var/log/mysql 是否存在,屬組和屬主是否是mysql

如果沒有,建立目錄,並更改目錄的所有者 chown mysql:mysql 

日常 解決mysql不允許外部訪問

1.在埠已經開放的情況下,ubuntu mysql 3306允許遠端訪問 vim etc mysql mysql.conf.d mysqld.cnf 注釋 bind address 127.0.0.1 2.給使用者授權允許遠端訪問 grant all privileges on to root id...

外部主機不允許連線Mysql設定的解決方法

如果你想連線你的mysql的時候發生這個錯誤 error 1130 host 192.168.1.3 is not allowed to connect to this mysql server 解決方法 1。改表法。可能是你的帳號不允許從遠端登陸,只能在localhost。這個時候只要在local...

mysql不允許遠端登入

剛安裝好的mysql不允許從遠端登入,只能在localhost。此時,在localhost上登入資料庫,將 user 表裡的 host 項從 localhost 改為 遠端就可以使用 ems sql manager for mysql 等客戶端工具進行連線了。mysql use mysql mysq...