MySql添加新用户及为用户创建数据库和给用户分配权限方法介绍
作者:星之刃火 时间:2024-01-29 01:03:10
1.添加新用户
只允许本地IP访问
create user 'test'@'localhost' identified by '123456';
允许外网IP访问
create user 'test'@'%' identified by '123456';
刷新授权
flush privileges;
2.为用户创建数据库
create database test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
3.为用户分配权限
授予用户通过外网IP操作该数据库的所有去权限
grant all privileges on `testdb`.* to 'test'@'%' identified by '123456';
授予用户通过外网IP操作所有数据库的权限
grant all privileges on *.* to 'test'@'%' identified by '123456';
刷新授权
flush privileges;
来源:https://blog.csdn.net/weixin_38981118/article/details/80467970
标签:MySql,添加用户,创建数据库,分配权限
0
投稿
猜你喜欢
Python pickle模块实现对象序列化
2022-03-04 03:51:22
编写一个javascript元循环求值器的方法
2024-04-23 09:28:15
python实现远程通过网络邮件控制计算机重启或关机
2022-04-16 01:05:27
python 中赋值,深拷贝,浅拷贝的区别
2022-11-15 09:35:44
如何利用Python实现简易的音频播放器
2022-07-16 11:47:32
django框架模板语言使用方法详解
2021-11-10 12:00:36
关于python中time和datetime的区别与用法
2022-07-15 00:54:17
golang使用 gomodule 在公共测试环境管理go的依赖的实例详解
2024-04-26 17:35:41
Go语言实现的web爬虫实例
2023-07-21 02:35:57
研究Python的ORM框架中的SQLAlchemy库的映射关系
2021-05-23 14:31:07
Python3使用PySynth制作音乐的方法
2021-03-18 19:41:01
记录PHP错误日志 display_errors与log_errors的区别
2023-11-14 09:38:29
Sql Server 开窗函数Over()的使用实例详解
2024-01-17 14:34:33
安装SQL2005 29506错误码的解决方案
2024-01-19 14:15:31
python贪吃蛇核心功能实现上
2021-12-06 15:49:18
Python实现两个list求交集,并集,差集的方法示例
2021-12-27 19:52:06
python 监控某个进程内存的情况问题
2022-12-05 16:55:58
Python定制类你不知道的魔术方法
2022-10-26 11:26:40
layui文件上传实现代码
2024-05-22 10:36:34
恢复.mdf 数据库步骤
2024-01-16 00:17:35