Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to optimize mysql on time under Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to optimize mysql regularly under Linux". In daily operation, I believe that many people have doubts about how to optimize mysql regularly under Linux. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to optimize mysql regularly under Linux". Next, please follow the editor to study!

Often we have to optimize the MySQL database, and the rookie will optimize the MyAdmin one by one.

The development of PHP is generally realized through php in the program of the website, but these two methods are not good enough.

Here's a trick: use a mysqlcheck command to do it. It's efficient and safe.

Try executing the following command in putty or crt:

Mysqlcheck-Aao-- auto-repair-u your user name-p your password

If nothing happens, you will find that all of your things have been optimized and repaired once!

If you prompt check that you can't find it, if not, skip this step.

The reason why I can't find mysqlcheck is usually compiled and installed manually. Just like me, I just locate mysqlcheck and find that under / usr/local/mysql/bin/, it is the path I specified when I installed MySQL.

Hey, OK, give him a shortcut.

Ln-s / usr/local/mysql/bin/mysqlcheck / usr/bin/mysqlcheck

Here are the meanings of the following parameters

-a,-- analyze analysis [Analyze given tables]

-o,-- optimize optimization [Optimize table]

-A,-- all-databases all databases [Check all the database]

-- auto-repair automatic repair [If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been

All right, add it to cron job and automatically execute it at 01:00 every day.

Crontab-e

0 1 * mysqlcheck-Aao-auto-repair-u your user name-p your password > / dev/null 2 > & 1

At this point, the study on "how to optimize mysql on a regular basis under Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report