Mysql怎样设定会员指定ip地址操纵数据库
发布时间:09/01 来源:未知 浏览:
关键词:
Mysql设定会员指定ip地址操纵数据库的办法:使用grant函数,语法为【grant priv_type on mysql.user to 'user'@'host' identified by 'password' with】。
Mysql设定会员指定ip地址操纵数据库的办法:
语法:
grant priv_type on mysql.user to 'user'@'host' identified by 'password' with grant option;
priv_type:代表同意操纵数据库的权限
user:代表数据库会员名
host:代表IP地址
password:代表设定的密码
刷新user权限表:flush privileges;
三、案例
1、设定所有数据库、所有表、任意ip可以连接数据库,授权给会员名ping并设定密码为123456
grant all on *.* to 'ping'@'%' identified by '123456'; flush privileges;
2、授权表cloud的记载修改权限给连接ip地址是192.168.100.1和会员名是ping并且密码为123456
grant update(name,sex) on cloud to 'ping'@'192.168.100.1' identified by '123456'; flush privileges;
四、查看数据库权限表
mysql> select * from mysql.user where host='localhost'\G; *************************** 1. row *************************** Host: localhost User: Password: Select_priv: N Insert_priv: N Update_priv: N Delete_priv: N Create_priv: N Drop_priv: N Reload_priv: N Shutdown_priv: N Process_priv: N File_priv: N Grant_priv: N References_priv: N Index_priv: N Alter_priv: N Show_db_priv: N Super_priv: N Create_tmp_table_priv: N Lock_tables_priv: N Execute_priv: N Repl_slave_priv: N Repl_client_priv: N Create_view_priv: N Show_view_priv: N Create_routine_priv: N Alter_routine_priv: N Create_user_priv: N Event_priv: N Trigger_priv: N ssl_type: ssl_cipher: x509_issuer: x509_subject: max_questions: 0 max_updates: 0 max_connections: 0 max_user_connections: 0