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
希望與廣大網友互動??
點此進行留言吧!