1、查看查询缓存设置情况;
show status like 'qcahce%';
2、查看最大连接数;
show variables like 'max_connections';
3、过去的最大连接数;
4、查看慢查询配置;
show variables like 'slow%';
5、open table情况;
show global status like 'open%tables%';
open_tables表示打开表的数量,opened_tables表示打开过的表数量;
6、超级用户登录;
mysql -h host -u user -p
在提示下输入超级用户密码,默认超级用户登录只能在安装数据库的主机,不能远程登录;
7、查看数据库列表;
show databases;(必须是超级用户)
create
database jiradb character set ‘UTF8′;
8、查看用户;
select host,user from mysql.user;(必须是超级用户)
9、创建用户并授权;
create
user jirauser identified by ‘jira’;
grant all privileges on *.* to ‘jirauser’@'%’ identified by ‘jira’ with grant option; grant all privileges on *.* to ‘jirauser’@'localhost’ identified by ‘jira’ with grant option; flush privileges; 10、设置和修改变量
select @@variable;
set GLOBAL variable=value;
11、复制表数据
select
a,b,c from oldtable into outfile 'a.txt';
load
data INFILE 'a.txt' into table newtable (a,b,c ) ;
12、锁住所有的表
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
13、
|
|