MySQL权限操作操作

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a6864657/article/details/84206397

查看数据库版本

select  version

查看当前时间

select now

查找用户

use  mysql
show   user
select  user  from  user

查看数据库编码

show  create database   name

查看创建数据表语句

show create  tablename

创建用户

 create  user  '用户名’@'IP地址' identifyed  by  '密码'
 
create  user  'zhangsan’@'192.168.11111' identifyed  by  '123456'						只能在此主机上登陆

create  user  'zhangsan’@'192.168.%' identifyed  by  '123456'						只能在前缀192.168.上登录

create  user  'zhangsan’@'%' identifyed  by  '123456'						在任何主机上均能登录

授权用户

grant  +  权限   +    on    +  数据库名.数据表明  +   to    '用户名'

grant  select, insert,update on  bookdb.book  to  'zhangsan'

grant   all privleges  on   bookdb.book to  'zhangsan'

猜你喜欢

转载自blog.csdn.net/a6864657/article/details/84206397