1, 首先,以root 权限登录进mysql ,并且选择mysql 数据库。
2, 执行 insert into user(Host, User, Password) values (“localhost”, “test’, password(“test123”));
3, 上述命令执行完了之后还不能登录进mysql,localhost可以改成 % 表示远程服务器也可登录;
4, 创建一个数据库 : create database test;
5, 将该数据库的所有操作权限赋给新创建的用户 : grant all privileges on “test.*” to “test@localhost” identified by “test123”;
6, 执行 flush privileges