标签:字符 分析 show height 信息 comm ssl replace 重要
1、-e :改参数表示不用登陆mysql就可以使用mysql的命令,有利于于加管道符对数据进行处理;
mysql -uroot -p123456 -e "show databases;"
2、查看连接到mysql的进程:
[root@db01 ~]# mysql -uroot -p123456 -e "show full processlist;"
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+-------+------------------+
| 1 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+----+------+-----------+------+---------+------+-------+------------------+
3、通过“show global variables”查看mysql的参数信息:
[root@db01 ~]# mysql -uroot -p123456 -e "show global variables;" | grep "log_bin"
log_bin ON
log_bin_trust_function_creators OFF
sql_log_bin ON
[root@db01 ~]# mysql -uroot -p123456 -e "show global variables like ‘log_bin‘;"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin | ON |
+---------------+-------+
4、通过"show global status"查看mysql会话状态:
[root@db01 ~]# mysql -uroot -p123456 -e "show global status;" | less
(1)查看mysql插入的进程:
[root@db01 ~]# mysql -uroot -p123456 -e "show global status;" | grep "sel"
Com_insert_select 0
Com_replace_select 0
Com_select 10
5、如何在不重启mysql的情况下修改mysql的配置并且生效:
只要不重启mysql就会一直生效;
[root@db01 ~]# mysql -uroot -p123456 -e "set global key_buffer_size = 1024*32;"
[root@db01 ~]# mysql -uroot -p123456 -e "show global variables like ‘key_buffer_size‘"
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| key_buffer_size | 32768 |
+-----------------+-------+
[root@db01~]# vim /etc/my.cnf #修改此参数就算是重启mysql设置的参数也会生效;
set global key_buffer_size = 32k
6、命令总结:
show session status:查看当前会话的数据库状态信息;
show global status:查看整个数据库运行的状态信息,很重要,要分析并做好监控;
show global variables:查看数据库的参数信息,列如my.cnf里参数的生效情况;
show global variables like ‘key_buffer_size‘:查看key_buffer_size的参数配置 like ‘%%‘,%代表任意一个字符;
show processlist:查看正在执行的sql语句,看不全;
show full processlist:查看正在执行的sql语句,全;
set global key_buffer_size=32 * 1024:不重启数据库调整数据库参数,直接生效,重启数据库后失效;
标签:字符 分析 show height 信息 comm ssl replace 重要
原文地址:https://www.cnblogs.com/LiuChang-blog/p/12315805.html