1. 创建新用户
本地访问用户
- create user 'aaa'@'localhost' identified by '123456';
远程访问用户
- create user 'aaa'@'%' identified by '123456';
flush privileges;
2. 创建数据库
- create database testdb;
3. 执行命令为testuser用户添加使用testDB权限
本地权限
- grant all privileges on mirai.* to 'aaa'@'localhost' identified by '123456' with grant option;
远程权限
- grant all privileges on mirai.* to 'aaa'@'%' identified by '123456' with grant option;
flush privileges;