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;
到此这篇关于mysql添加新用户及为用户创建数据库和给用户分配权限方法介绍的文章就介绍到这了,更多相关mysql添加新用户为用户创建数据库和给用户分配权限内容请搜索移动技术网以前的文章或继续浏览下面的相关文章希望大家以后多多支持移动技术网!
如对本文有疑问, 点击进行留言回复!!
mysql·update语句报错:Data truncation: Truncated incorrect DOUBLE value: ‘系统开小差啦~请稍后再试‘
MySQL Fix Product Name Format(trim去空格+upper/lower大小写)
mysql pxc LIMITATIONS 8.0.19-10
网友评论