时间:2021-07-01 10:21:17 帮助过:30人阅读
2、全局只读
1 #设置全局只读 2 set global read_only=1; 3 4 #取消全局只读 5 set global read_only=0;
3、获取数据库每个ip的连接数
1 #获取数据库每个ip的连接数 2 # /usr/local/mysql/bin/mysql -u root -h127.0.0.1 -e"show processlist\G;"| egrep "Host\:" | awk -F: ‘{ print $2 }‘| sort | uniq -c 3 4 # /usr/local/mysql/bin/mysql -u root -h127.0.0.1 --skip-column-names -e"show processlist;"|awk ‘{print $3}‘|awk -F":" ‘{print $1}‘|sort|uniq -c 5 6 mysql> select SUBSTRING_INDEX(host,‘:‘,1) as ip , count(*) from information_schema.processlist group by ip;
4、手动删除二进制日志
1 #手动删除binlog 2 mysql> purge master logs to ‘master-bin.000480‘; #删除master-bin.000480之前的二进制日志
5、全局读锁
1 #增加读锁 2 mysql> flush tables with read lock; 3 mysql> unlock tables; #释放读锁
6、创建数据库已utf8编码格式及导入sql文件乱码
1 #创建数据库以utf8格式 2 CREATE DATABASE oma DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 3 4 #mysql source命令乱码
MySQL常用命令
标签:-name bsp 取数据 substring 乱码 host info tab thread