Check and Optimize MySQL Database Automatically with Crontab/Cron MySQLデータベースの最適化を自動的にチェックのcrontab / cronの
MySQL is a very popular free yet powerful database system. MySQLは非常に人気のある無料の強力なデータベースシステムはまだありません。 But even in great databases, the tables may get fragmented with overhead due to continuous update, or delete and insert operation on data stored in database.しかし、大きなデータベースでも、そのテーブルのオーバーヘッドがあります。断片化のために継続的に更新、または挿入操作上のデータを削除してデータベースに格納されています。 Beside, it’s also possibility that the databases may get corrupted.横に、データベースの可能性があることも5月に破損しています。 Thus, performing health check on database and optimize MySQL server regularly is an important task.したがって、舞台の健康をチェックするデータベースとMySQLサーバの最適化を定期的には、重要な仕事です。
It’sa bit troublesome if the database administrators have to login to the server or launching the phpMyAdmin to optimize the databases one by one or table by table manually.これはビット面倒な場合は、データベース管理者は、打ち上げにログインするには、サーバーやphpMyAdminのデータベースを最適化してテーブルを1つのテーブルを1つまたは手動で作成します。 Sometimes DB admin may simply forgets to do the job or set the frequency of optimization to lesser times.時にはdBの管理者を忘れることは、単に仕事または設定するには、周波数の最適化を小回クリックします。 It’s recommended that every tables in MySQL databases are checked at least once a day on a busy server.することをお勧めMySQLデータベースのテーブルのすべてのチェックボックスを、少なくとも一日に一度は、忙しいサーバです。
It’s possible to automate the optimization of MySQL process by using crontab function in Linux/Unix/CentOS/FreeBSD.最適化することが可能にMySQLのプロセスを自動化するcrontabの関数を使用してLinux / Unix版/ CentOS版/ FreeBSDのです。 The cron job to check and optimize MySQL databases can be created by using mysqlcheck client utility comes MySQL installation. cronジョブを確認すると、 MySQLデータベースを最適化できるユーティリティを使用して作成さmysqlcheckクライアントはMySQLがインストールされています。 mysqlcheck client can checks, repairs, optimizes, and analyzes tables in MySQL database. mysqlcheckクライアントをチェック、修復、最適化、およびMySQLデータベースのテーブルに分析しています。
To create a new cron job, login to the server as root or any other user, and then edit the crontab file (in most operating system, crontab -e will open crontab file in default text editor) to add in the following line of text.新しいcronジョブを作成するには、 rootとしてログインするには、サーバーまたは他のユーザーと入力し、編集してcrontabファイル(ほとんどのオペレーティングシステムでは、 crontab - eでは、デフォルトのテキストエディタで開いてcrontabファイル)を追加するには、次の行のテキストです。 For users using cPanel, click on “Cron job” where you can set up crontab at daily, hourly and other interval.ご利用の皆様へcpanelを使用して、をクリックして" cronジョブ"どこのcrontabをセットアップすることができます。毎日、 1時間およびその他の間隔です。 Experience webmasters can also set up a crontab file in rc.hourly or rc.daily or other cron directory.ウェブマスターの経験を設定することもできます。 crontabファイルにrc.hourlyまたはrc.dailyまたはその他のcronのディレクトリにコピーします。 Note that if you login as a MySQL or normal user with no access privileges to all database, it’s not possible to optimize all databases, unless user ID and password for root is specified as in example below.に注意している場合は通常のユーザとしてログインし、 mysqlまたはすべてのデータベースにアクセス権限がないことはできませんすべてのデータベースを最適化し、利用者番号とパスワードを入力しない限り、ルートは以下の例のように指定します。
0 1 * * * mysqlcheck -Aao –auto-repair -u root -p[password] > /dev/null 0 1 * * * mysqlcheck - aao -自動車修理- uルート- p [パスワード] > / dev / nullに
The above statement has the syntax similar to “mysqlcheck [options] –all-databases”, where –all-databases parameter is the default action is no databases is specified thus can be omitted.上記の声明には、構文のように" mysqlcheck [オプション] -すべてのデータベース" 、ここですべてのデータベースのパラメータは、デフォルトのアクションはないのデータベースを指定することができるので省略している。 The command will run mysqlcheck client to automatically analyze and optimize all databases at 1 am everyday.このコマンドが実行さmysqlcheckクライアントを自動的に分析し、午前1時に日常のすべてのデータベースを最適化します。 Note that there is not space between -p and your password for root.に注意して間にスペースがない- pおよびルートのパスワードをしています。 You can change the running time to your preference, and also change the options for mysqlcheck command.上映時間を変更することができます好みに合わせて選択し、 mysqlcheckのオプションを変更してもコマンドを実行します。 If you just want to check and optimize certain databases or certain tables without the database, use the following syntax:をチェックするだけなら、特定のデータベースや、特定のテーブルの最適化をせず、データベースは、以下の構文:
mysqlcheck [options] db_name [tables] mysqlcheck [オプション] db_name [テーブル]
mysqlcheck [options] –databases DB1 [DB2 DB3...] mysqlcheck [オプション] -データベースdb1 [ DB2のdb3とは同時に使えません... ]
You may want to remove –auto-repair switch from the above command, as a table repair operation might cause data loss under some circumstances the operation due to causes include but are not limited to filesystem errors.することができます-自動車修理スイッチを削除するより、上記のコマンドで、テーブルの修復処理として、データの損失を引き起こすかもしれない状況下での操作のためにいくつかの原因が含まれていない限定されるファイルシステムエラーが発生します。 For those who has changed the character set and collation of MySQL databases may also need to use –default-character-set option. whoには、これらのキャラクタセットと照合順序を変更してMySQLのデータベースを使用することも必要なデフォルトの文字セットのオプションを選択します。 More information on all available switches and options available can be foundより詳しい情報について利用可能なすべてのスイッチとオプションをご利用があります hereここで .です。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要 :これは、機械翻訳ページで提供"現状有姿"を保証します。 Machine translation may be difficult to understand.機械翻訳を理解するのは難しいかもしれません。 Please refer toを参照してください original English articleオリジナルの英語記事索引 whenever possible.いつ可能です。
Share and contribute or get technical support and help atを共有して貢献や技術サポートとヘルプを得る My Digital Life Forums 私のデジタルライフフォーラム .です。
Related Articles関連記事
- MySQL Database Performance Tuning Best Practices Video Tutorial MySQLデータベースのパフォーマンスチューニングのベストプラクティスのビデオチュートリアル
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4ウェブサーバーでは、 Windows XPをインストールするのApache2 、 PHP5とmysql4 -パート4
- Change and Reset MySQL root Password MySQLのrootのパスワードを変更し、リセット
- How to Find and Replace Text in MySQL Database using SQL内のテキストを置換する方法を検索し、 MySQLデータベースを使用してのSQL
- WordPress MySQL SQL Query Error in WPDB Class WordPressのMySQLのSQLクエリにエラーが発生wpdbクラス
- Change or Set MySQL Long Query Time Value for log-slow-queries MySQLの長いクエリを変更または時間の値を設定することもできます。クエリが遅い
- Using PHP-MySQL Persistent Connections to Run WordPress Blogを使用してのPHP - MySQLの持続的接続を実行するのWordPress Blog
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Databaseログを有効に遅いクエリ(スロークエリログ)にMySQLのデータベースの
- How to Delete Existing WordPress Post Revisions Stored/Saved既存のWordPressの投稿を削除する方法の改訂に格納/保存
- Remove or Trim First or Last Few Characters in MySQL Database with SQLトリム削除したり、最初または最後の数文字をMySQLデータベースをSQL

































January 16th, 2008 06:40 2008年1月16日06:40
Note that -–auto-repair should have two dashesに注意して-自動車修理には2つのダッシュ
Also, you might want to leave “> /dev/null” out for the first few runs, to see the results of the command (if you put MAILTO=me@mydomain.com at the top of the crontab, the results will get sent there).また、したいかもしれませんを残す" > / dev / nullに"するための最初の数を実行すると、検索結果を表示するには、コマンド( mailto = me@mydomain.comを置く場合の上部には、 crontabに、その結果を得る送られるが) 。
May 6th, 2008 19:15 2008年5月6日19:15
I did not know that it was nesessary to perform a regular check for mysql.それは知りませんがnesessaryして定期的なチェックを実行するにはMySQLです。