允許本地 ip 訪問 localhost, 127.0.0.1
create user 'test'@'localhost' identified by '123456';
允許外網 ip 訪問
create user 'test'@'%' identified by '123456';
重新整理授權
flush privileges;
create database test default charset utf8 collate utf8_general_ci;
授予使用者通過外網ip對於該資料庫的全部許可權
grant all privileges on `testdb`.* to 'test'@'%' identified by '123456';
授予使用者在本地伺服器對該資料庫的全部許可權
grant all privileges on `testdb`.* to 'test'@'localhost' identified by '123456';
重新整理許可權
flush privileges;
用新帳號 test 重新登入,由於使用的是 % 任意ip連線,所以需要指定外部訪問ip
mysql -u test -h 115.28.203.224 -p
# instead of skip-networking the default is now to listen only on# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1 #註釋掉這一行就可以遠端登入了
允許本地 ip 訪問 localhost, 127.0.0.1
create user 'test'@'localhost' identified by '123456';
允許外網 ip 訪問
create user 'test'@'%' identified by '123456';
重新整理授權
flush privileges;
create database test default charset utf8 collate utf8_general_ci;
授予使用者通過外網ip對於該資料庫的全部許可權
grant all privileges on `testdb`.* to 'test'@'%' identified by '123456';
授予使用者在本地伺服器對該資料庫的全部許可權
grant all privileges on `testdb`.* to 'test'@'localhost' identified by '123456';
重新整理許可權
flush privileges;
用新帳號 test 重新登入,由於使用的是 % 任意ip連線,所以需要指定外部訪問ip
mysql -u test -h 115.28.203.224 -p
# instead of skip-networking the default is now to listen only on# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1 #註釋掉這一行就可以遠端登入了
MySQL建立新使用者並分配許可權
在mysql中使用者許可權是一個很重要的引數,因為臺mysql伺服器中會有大量的使用者,每個使用者的許可權需要不一樣的,下面我來介紹如何給mysql使用者分配許可權吧,有需要了解的朋友可參考。1 mysql下建立新的使用者並分配許可權 mysql create user ywliyq identif...
mysql新增新使用者並分配許可權
mysql u root grant 許可權1,許可權2,許可權n on資料庫名稱.表名稱 to使用者名稱 使用者地址 identified by 連線口令 許可權1,許可權2,許可權n代表select,insert,update,delete,create,drop,index,alter,gra...
mysql 新增使用者並分配許可權
grant 許可權1,許可權2,許可權n on 資料庫名稱.表名稱 to 使用者名稱 使用者地址 identified by 連線口令 許可權1,許可權2,許可權n代表select,insert,update,delete,create,drop,index,alter,grant,referenc...