数据库优化方案
慢日志查询
1.查看慢查询是否开启
show variables like ‘slow_query%’; show variables like ‘long_query_time’; 2.打开慢查询 set global slow_query_log=’ON’; 3.设置慢查询日志记录文件 set global slow_query_log_file=’/var/lib/mysql/test-10-226-slow.log’; 4.指定慢查询事件 set global long_query_time=1;
数据库的导入导出
导出: mysql dump -u root -p 库名 >导出的文件.sql 导入: mysql -u root -p 库名