1.创建一个用户
CREATE USER xjc1@localhost IDENTIFIED BY '123456';
2.给用户添加权限
grant all privileges on mes_db.* to xjc1@localhost
GRANT INSERT,DELETE,UPDATE,SELECT ON mes_db.* TO 'xjc'@'localhost';
3.重载权限表
flush privileges;
4.设置用户密码的加密方式
ALTER USER 'xjc1'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
5.用户基本数据查询
select user,host,authentication_string from mysql.user;
6.显示默认的加密方式
mysql> show variables like 'default_authentication_plugin';
+-------------------------------+-----------------------+
| Variable_name | Value |
+-------------------------------+-----------------------+
| default_authentication_plugin | mysql_native_password |
+-------------------------------+-----------------------+
7.修改密码
ALTER USER 'xjc1'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';