1.登陆 >mysql -u root -p,root没密码按回车。
2.创建数据库 >create database XXX;
3.创建用户 >insert into mysql.user(Host,User,Password) values("localhost","xxx",password("xxxxxx"));
4.为用户授权 >grant all privileges on xxxdatabase.* to xxx@localhost identified by ‘xxxxxx‘;
或者部分授权 >grant select,update on xxxdatabase.* to xxx@localhost identified by ‘xxxxxx‘;
刷新系统权限表>flush privileges;