1.检查运行状态并以‘root’用户登陆:
$ systemctl status mysql
$ sudo mysql -u root -p
$ 系统密码
$ 登陆密码
2.创建数据库db_test:
$ create database db_test;
3.使用数据库:
$ use db_test;
4.查看数据:
$ show databases;//列出数据库列表
$ show tables; //列出所有表
$ select * from tables; ///显示表tables中的记录
5.删除:
$ drop database db_test;
6.创建新用户admin(password:123456)并修改授权:
$ create user ‘admin’@‘localhost’ identified by ‘123456’;
$ ALTER USER ‘admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
7.罗列所有用户并删除admin用户:
$ select user,host from mysql.user;
$ drop user ‘admin’@‘localhost’;
8.报错统计
密码策略错误:参考这篇:Your password does not satisfy the current policy requirements