- 创建数据库 && 创建用户相关
1
2
3
4
5
6
7
8CREATE DATABASE jira CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on jira.* TO 'jira'@'%' IDENTIFIED BY '123456';
flush privileges;
CREATE DATABASE bitbucket CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'bitbucket'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON bitbucket.* TO 'bitbucket'@'%';
FLUSH PRIVILEGES; - mysql备份
1
2mysqldump -uroot -p123456 --databases jira bitbucket | gzip > /tmp/atl-$(date +%Y%m%d).sql.gz //生成sql压缩文件
mysqldump -uroot -p123456 --databases jira bitbucket > /tmp/atl-$(date +%Y%m%d).sql //生成sql文件 - 开启慢查询
1
2
3
4
5
6set global slow_query_log='ON';
cd /var/log/mysql/
touch slow.log
chown mysql. slow.log
set global slow_query_log_file='/var/log/mysql/slow.log';
set global long_query_time=2; - 查看和修改最大连接数
1
2show variables like '%max_connections%';
set GLOBAL max_connections = 200;