1.修改密码
create user 'root'@'%' identified by '123456';
或
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
2.授权
grant all on *.* to 'root'@'%';
alter user 'root'@'%' identified with mysql_native_password by '123456';
3.刷新
flush privileges;
记录常用命令
1.登录
mysql -uroot -p
2.查看所有数据库
show databases;
3.退出
exit/quit
4.使用数据库
use 库名;
5.创建数据库:
create 库名;
6.查看表结构
desc 表名;
7.删除表
drop table 表名;
8.删除库
drop database 库名;
9.查询表结构
show create table 表名;