MySQL常用信息函数

 

 

第三章 MySQL常用信息函数

3.1 密码修改

set password = ‘123’

set passsword for aa@‘%’ = ‘’;

create user aa identified with caching_sha2_password by '123'

alter user 'root'@'localhost' identified with mysql_native_password by 'password'

set password for root@localhost = password('123')

set password = 'admin' 当前账号添加密码

flush privileges 更新权限

 

3.2 常用的信息函数

select version(); --当前数据库服务器版本信息
select database(); --输出当前使用的数据库名称
select current_user() 或 select user(); --当前用户
select curdate() 或 select current_date();  --当前日期
select curtime() 或 select current_time(); --当前时间
select current_timestamp() 或 select now(),sysdate(); --当前日期和时间
show tables;  --显示所有表 show table status
show databases; --显示所有库
show create database db_name;  --查看标准建库语句
show create table tb_name; --查询标准建表语句
show full columns from studentinfo; -- 查看表字段信息
show variables like ‘char%’; -- 显示当前数据库服务器的相关字符集信息
show charset;  -- 查看服务器支持的字符集
show engines;   -- MyISAM     ENGINE=InnoDB default charset=utf8
show status like 'Threads_connected';  -- 得到当前的连接数
show processlist; -- 显示当前正在执行的mysql连接
select @@basedir,@@datadir,@@max_connections;
SHOW PROCESSLIST
SHOW FULL PROCESSLIST
SHOW VARIABLES LIKE '%max_connections%'
SHOW STATUS LIKE '%Connection%‘
show variables;
select @@basedir,@@datadir;
show variables like '%dir%';
show variables like '%max%';
select @@max_connections;
show variables like '%connect%';
show status like 'Threads%';

 

原文地址:https://www.cnblogs.com/liuyunche/p/14417807.html