Now Hiring: Are you a driven and motivated 1st Line IT Support Engineer?

Blog

Centos 虚拟主机服务 服务器 定时优化MYSQL数据库

Centos 虚拟主机服务 服务器 定时优化MYSQL数据库

MYSQL 5 虚拟主机服务的服务器 需要定时优化

这个建议做虚拟主机服务的 都定时的优化
有的时候一些菜鸟 能把人折腾死 1G的数据库 有100M以上的碎片
尤其高负载的服务器

mysqlcheck和myisamchk的用法!
在指令中下
mysqlcheck -a -c -o -r –all-databases -uroot -p
即可优化所有数据库
參數的意義如下:
-a = Analyse given tables. 分析表
-c = Check table for errors 检查表错误
-o = Optimise table 优化表
-r = Can fix almost anything except unique keys that aren’t unique 修复表

mysqlcheck -a -c -o -r –all-databases -uroot -p密码 80

myisamchk可用crontab定時最佳化table
crontab -e
添加下面的
0 * * 0 /usr/bin/myisamchk -s /var/lib/mysql/*/*.MYI

路径需要自己找下
如果不对的话 可以使用 find / -name “myisamchk” 进行搜索
 

Leave your thought here

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare