Mysql 5.6添加修改用户名和密码的方法
作者:xy2204 时间:2024-01-20 09:02:57
先登录MySQL
shell> mysql --user=root mysql
有密码的需要添加 –password 或-p 选项
添加用户
mysql>CREATE USER 'finley'@'localhost' IDENTIFIED BY 'some_pass';
mysql>GRANT ALL PRIVILEGES ON *.* TO 'finley'@'localhost' WITH GRANT OPTION;
mysql>CREATE USER 'finley'@'%' IDENTIFIED BY 'some_pass';
mysql>GRANT ALL PRIVILEGES ON *.* TO 'finley'@'%' WITH GRANT OPTION;
mysql>CREATE USER 'admin'@'localhost' IDENTIFIED BY 'admin_pass';
mysql>GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
mysql>CREATE USER 'dummy'@'localhost';
添加用户并设置数据库具体权限:
mysql>CREATE USER 'custom'@'localhost' IDENTIFIED BY 'obscure';
mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON bankaccount.* TO 'custom'@'localhost';
mysql>CREATE USER'custom'@'host47.example.com' IDENTIFIED BY 'obscure';
mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON expenses.* TO 'custom'@'host47.example.com';
mysql>CREATE USER 'custom'@'%.example.com' IDENTIFIED BY 'obscure';
mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON customer.* TO 'custom'@'%.example.com';
删除用户:
mysql>DROP USER 'jeffrey'@'localhost';
修改密码:
mysql>SET PASSWORD FOR 'jeffrey'@'localhost' = PASSWORD('mypass');
修改当前登录用户密码:
mysql>SET PASSWORD = PASSWORD('mypass');
以上所述是小编给大家介绍的Mysql 5.6添加修改用户名和密码的方法网站的支持!
来源:http://blog.csdn.net/xy2204/article/details/74520079
标签:mysql,用户名,密码
0
投稿
猜你喜欢
源码编译安装MySQL8.0.20的详细教程
2024-01-22 11:55:52
javascript验证只能输入数字和一个小数点示例
2024-04-22 22:29:11
Matplotlib中rcParams使用方法
2022-12-14 03:41:46
新功能的帮助与破坏
2010-01-17 10:15:00
详解Django中的FBV和CBV对比分析
2023-04-30 13:27:38
Mysql自动备份与还原方法
2024-01-15 03:19:32
Python运用于数据分析的简单教程
2023-08-14 07:49:13
Python连接es之es更新操作示例详解
2022-11-21 06:11:48
MySQL数据库优化经验详谈(服务器普通配置)第1/3页
2024-01-27 23:30:51
微信小程序开发常见问题及解决方案
2024-04-18 09:35:04
JavaScript监听和禁用浏览器回车事件实例
2023-10-12 01:58:16
Access中实现case when功能
2009-04-28 13:02:00
MySQL全文索引、联合索引、like查询、json查询速度哪个快
2024-01-17 21:24:06
Mysql给普通分页查询结果加序号实操
2024-01-16 21:06:07
python实现三次密码验证的示例
2022-01-24 16:34:25
Selenium 滚动页面至元素可见的方法
2022-06-01 14:01:05
让长字符自动换行 比如URL和Email地址等
2008-07-01 14:41:00
关于Python网络爬虫requests库的介绍
2021-10-20 23:13:52
MYSQL中怎样设列的默认值为Now()的介绍
2008-11-01 16:54:00
Python操作Excel的学习笔记
2022-04-02 16:43:29