1. 修改MySQL的root用户密码
/**修改密码**/
set password for 'root'@'localhost' = password('123456');
/**修改密码**/
update mysql.user set Password = password('123456') where User='root';
/**刷新**/
flush privileges;
2. 创建用户并授权
/**创建用户**/
create user what21 identified by '123456';
/**将数据库(db_console)的所有权限授权给用户**/
grant all privileges on db_console.* to what21@localhost identified by '123456';
/**将数据库(test)的所有权限授权给用户**/
grant all privileges on test.* to what21@localhost identified by '123456';
/**授权所有权限给用户**/
grant all privileges on *.* to what21@localhost identified by '123456';
/**授权用户远程访问**/
grant all on *.* to what21@"%" identified by '123456';
/**刷新**/
flush privileges;
/**查看用户信息**/
select Host,User,Password from mysql.user;
/**修改用户密码**/
update mysql.user set Host='0.0.0.0',Password='123456' where User='what21';
3. 删除授权和用户
/**删除用户授权**/
drop user what21@'localhost';
/**删除用户**/
drop user what21;
/**删除用户**/
delete from mysql.user where User='what21';
/**查看用户信息**/
select Host,User,Password from mysql.user;