Mysql添加用戶
使用可以對mysql數據庫用戶表有操作權限的用戶名登陸mysql
insert into user(Host,User,Password) values('%','name','password');
如果work用戶沒有登陸權限,則
killall mysqld
share/mysql/mysql.server start
grant all on *.* to work@'%' identified by "password";
MySQL賦予用戶權限的命令的簡單格式為
grant 權限 on 數據庫對象 to 用戶
grant 權限 on 數據庫對象 to 用戶 identified by "密碼"
用戶名:ad,密碼:ad_pass,登陸ip:192.168.0.10
//用戶在所有登陸ip的權限
grant all on *.* to ad@‘%’ identified by "ad_pass";
//開放管理MySQL中所有數據庫的權限
grant all on *.* to ad@'192.168.0.10' identified by "ad_pass";
//開放管理MySQL中具體數據庫(test)的權限
grant all privileges?on test to ad@'192.168.0.10' identified by "ad_pass";
或
grant all on test to ad@'192.168.0.10' identified by "ad_pass";
//開放管理MySQL中具體數據庫中的表(test.table1)的權限
grant all on test.table1 to ad@'192.168.0.10' identified by "ad_pass"
//開放管理MySQL中具體數據庫的表(test.table1)的部分列的權限
grant select(id,se,rank) on test.table1 to ad@'192.168.0.10' identified by "ad_pass";
//開放管理操作指令
grant select,insert,update,delete on test.* to ad@'192.168.0.10' identified by "ad_pass";
//回收權限
revoke all on *.* from ad@localhost;
//查看MySQL用戶權限
show grants;
show grants for ad@localhost;
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
