需求描述:记录一些不常用、而又好用的指令
指令:
登录:mysql -u root -p
创建数据库:create database djangostudy
创建用户:create user ‘yeqinfang’@’%’ identified by ‘yeqinfang’;
查看密码策略:show variables like “%validate%”;
临时设置密码策略(不同版本全局变量不一样):
set global validate_password.length=6;
set global validate_password.policy=0;
给以用户(包括自己)权限:grant all privileges on . to ‘yeqinfang’@’%’;
刷新权限:FLUSH PRIVILEGES;
更换密码验证方式:ALTER USER ‘username’@’%’ IDENTIFIED WITH mysql_native_password BY ‘password’;
查看版本:select version();
查看端口:show global variables like ‘port’;
查看数据库时区:show variables like’%time_zone’;
设置时区:set global time_zone = ‘+8:00’;
查看表结构:desc (tablename)