net start mysql 运行数据库
net stop mysql 停止数据库
mysql -hlocalhost -uroot -p密码 登录
show databases; 显示数据库列表
create database 库名; 新建库
drop database 库名; 删除库
use 库名; 选择库
show tables; 显示库中的表
describe 表名; desc 表名; 显示表结构
select * from 表名; 查看表数据
select user,host,password from mysql.user; 查询用户名,密码
show grants for '用户名'@'localhost'; 查看用户权限
create user '用户名'@'localhost' identified by '密码'; 创建用户,密码
update user set authentication_string =password('password') where user='user'; 设置用户密码
update user set plugin='mysql_native_password'; 修改plugin参数
grant all on 库名.表名 to '用户名’@‘%’; 授予用户对相应库表所有权限
drop user '用户名'@‘%'; 删除用户
flush privileges; 刷新