运行命令行

mysql -uroot -p

登录mysql

use mysql;

创建用户:
create user 'test123'@'localhost' identified by '12345';
这里的test123表示User,localhost表示Host,12345表示authentication_string(密码)

授权:
grant all privileges on *.* to 'test123'@'localhost';
这里的*.* 可以改成 testdb.*,testdb 表示具体的某一个库,testdb.*表示 testdb库的所有表
这里的all privileges表示所有权限,权限分为:select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限
所以这里也可以这样授权:
grant select,insert,update,delete on *.* to 'test123'@'localhost';

grant select,insert,update,delete,create,alter,drop on testdb.* to 'test123'@'localhost';

撤消授权:

revoke all on *.* from 'test123'@'localhost';

刷新:

flush privileges;

做完增删改之后都要记得刷新授权

查看用户操作权限:
show grants for 'test123'@'localhost';

最新文章

  1. 使用Xmanager访问CentOS远程桌面
  2. 移动端js知识总结
  3. PHP 线程安全与非线程安全版本的区别深入解析
  4. MongoDB增删查改
  5. Swift3.0语言教程比较、判断字符串
  6. 教你搞定Android自定义View
  7. VS2010中查询替换使用
  8. commoncrawl 源码库是用于 Hadoop 的自定义 InputFormat 配送实现
  9. STL内存管理
  10. C#如何连接wifi和指定IP
  11. javascript函数传值问题(传值?址)
  12. H5 34-背景图片
  13. 鼠标hover图片时遮罩层匀速上升显示内容top、定位
  14. 第三章 C#程序结构[3.2 选择结构的应用(Windows窗体应用程序)(四)]
  15. ExecuteNonQuery()
  16. svn中的ignore
  17. hadoop商业版本的选择介绍
  18. SharePoint 2013 Farm 安装指南——构建一个双层SharePoint Farm
  19. 按着shift键对dbgrid进行多条记录选择的问题(50分)
  20. Ice Cream Tower

热门文章

  1. js 阻止事件冒泡
  2. 初学者在ubuntu下安装使用git(上)
  3. Linux-文件和目录操作命令
  4. Path之Data属性语法A命令
  5. JavaScript高级程序设计学习笔记--DOM
  6. .deb包的安装方法
  7. js生成带参的二维码
  8. Java基本数据类型与位运算
  9. 教你分分钟开发一个属于自己的python模块(一)——能够直接在浏览器打印的方法
  10. selenium实战-Compound class names not permitted