mysql权限添加
说明:
有时候我们需要给某个用户可以登录mysql的权限,或者是修改某个用户的密码,就需要用到如下的命令.
用法:
1 | grant all privileges on *.* to root@'%' identified by '123456'; (第一个*是databases 第二个*是table) |
实例:
1 | mysql>grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by '123'; |
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123.
1 | mysql>grant all privileges on vtdc.* to joe@10.163.225.87 identified by '123'; |
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123.
1 | mysql>grant all privileges on *.* to joe@10.163.225.87 identified by '123'; |
给来自10.163.225.87的用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123.
1 | mysql>grant all privileges on *.* to joe@localhost identified by '123'; |
给本机用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123.
1 | mysql>grant all privileges on dod_production.* to epics@219.111.52.144 identified by 'KgDqET48'; |
给ip地址为219.111.52.144的用户远程操作美国服务器上dod_production数据库的所有权限,并设定口令为KgDqET48. 电脑重启后,执行如下命令:
1 | /etc/init.d/mysql stop |