一、登录Mysql数据库
mysql -uroot -p
二、用户管理
1、创建用户
create user 'test'@'localhost' identified by '123456'
flush privileges
2、查询用户
use mysql
select user from user;
select user,host from user;
3、删除用户
drop user 'test'@'localhost';
flush privileges;
三、数据库操作
1、创建数据库
create database testdb;
2、为用户赋予操作数据库testdb的权限
grant all privileges on testdb.* to test@localhost identified by '123456'
flush privileges;