Check and Optimize MySQL Database Automatically with Crontab/Cron Memeriksa dan Optimalkan MySQL Database secara otomatis dengan crontab / Cron
MySQL is a very popular free yet powerful database system. MySQL sangat populer gratis namun handal database sistem. 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. Tetapi bahkan dalam database besar, yang mendapatkan meja Mei-bagi dengan overhead karena terus memperbarui, atau menghapus dan memasukkan operasi pada data yang tersimpan pada database. Beside, it's also possibility that the databases may get corrupted. Disamping, itu juga kemungkinan bahwa database juga bisa rusak. Thus, performing health check on database and optimize MySQL server regularly is an important task. Oleh karena itu, melakukan pemeriksaan kesehatan di database dan mengoptimalkan MySQL server secara berkala merupakan tugas penting.
It's a 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. It's a bit repot jika ada database administrator untuk login ke server atau meluncurkan phpMyAdmin untuk mengoptimalkan database satu per satu atau meja oleh tabel secara manual. Sometimes DB admin may simply forgets to do the job or set the frequency of optimization to lesser times. Kadang-kadang DB admin dapat dengan mudah lupa untuk melakukan pekerjaan atau mengatur frekuensi optimasi ke kurang kali. It's recommended that every tables in MySQL databases are checked at least once a day on a busy server. Ini direkomendasikan bahwa setiap tabel pada database MySQL telah dicentang setidaknya satu kali dalam sehari pada sibuk server.
It's possible to automate the optimization of MySQL process by using crontab function in Linux/Unix/CentOS/FreeBSD. Ini mungkin untuk secara otomatis proses optimasi dari MySQL dengan menggunakan crontab fungsi di Linux / Unix / CentOS / FreeBSD. The cron job to check and optimize MySQL databases can be created by using mysqlcheck client utility comes MySQL installation. Pekerjaan yang cron untuk memeriksa dan mengoptimalkan MySQL database dapat dibuat dengan menggunakan utilitas klien mysqlcheck datang MySQL instalasi. mysqlcheck client can checks, repairs, optimizes, and analyzes tables in MySQL database. mysqlcheck klien dapat memeriksa, perbaikan, optimal, dan menganalisa tabel pada database 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. Untuk membuat cron pekerjaan baru, login ke server sebagai root atau pengguna lainnya, dan kemudian mengedit crontab file (dalam banyak sistem operasi, crontab-e crontab akan terbuka file dalam editor teks default) untuk menambahkan baris berikut dalam teks . For users using cPanel, click on “Cron job” where you can set up crontab at daily, hourly and other interval. Untuk pengguna yang menggunakan cPanel, klik "Cron pekerjaan" di mana Anda dapat mengatur crontab di harian, jam dan lainnya Interval. Experience webmasters can also set up a crontab file in rc.hourly or rc.daily or other cron directory. Pengalaman webmaster juga dapat membuat file dalam rc.hourly crontab atau cron rc.daily atau direktori. 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. Catatan bahwa jika Anda login sebagai user biasa atau MySQL tanpa hak akses ke semua database, maka tidak mungkin untuk mengoptimalkan semua database, kecuali user ID dan password untuk root yang ditentukan seperti pada contoh di bawah ini.
0 1 * * * mysqlcheck -Aao –auto-repair -u root -p[password] > /dev/null 0 1 * * * mysqlcheck-Aao-auto-perbaikan-u root-p [password]> / 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. Pernyataan di atas memiliki sintaks mirip dengan "mysqlcheck [pilihan]-all-database", di mana-semua-parameter database adalah tindakan standar ada database yang ditentukan sehingga dapat diabaikan. The command will run mysqlcheck client to automatically analyze and optimize all databases at 1 am everyday. Akan menjalankan perintah mysqlcheck ke klien secara otomatis menganalisis dan mengoptimalkan semua database di 1 sehari-hari. Note that there is not space between -p and your password for root. Perlu diketahui bahwa tidak ada spasi antara-p dan password untuk root. You can change the running time to your preference, and also change the options for mysqlcheck command. Anda dapat mengubah waktu berjalan ke preferensi Anda, dan juga mengubah pilihan mysqlcheck perintah. If you just want to check and optimize certain databases or certain tables without the database, use the following syntax: Jika Anda hanya ingin memeriksa dan mengoptimalkan tertentu database atau tabel tertentu tanpa database, gunakan sintaks berikut:
mysqlcheck [options] db_name [tables] mysqlcheck [options] db_name [tables]
mysqlcheck [options] –databases DB1 [DB2 DB3...] mysqlcheck [pilihan]-database 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. Anda mungkin ingin menghapus-auto-perbaikan beralih dari perintah di atas, seperti meja operasi perbaikan dapat menyebabkan hilangnya data di bawah beberapa keadaan yang menyebabkan operasi karena termasuk tetapi tidak terbatas pada filesystem kesalahan. For those who has changed the character set and collation of MySQL databases may also need to use –default-character-set option. Bagi mereka yang telah berubah karakter menetapkan dan pemeriksaan dari MySQL database juga harus menggunakan karakter-default-menetapkan pilihan. More information on all available switches and options available can be found Informasi lebih lanjut tentang semua tersedia aktif dan pilihan yang tersedia dapat ditemukan here di sini . .
IMPORTANT : The page is machine translated and provided "as is" without warranty. PENTING: Halaman yang diterjemahkan mesin dan diberikan "sebagaimana adanya" tanpa jaminan. Machine translation may be difficult to understand. Mesin terjemahan mungkin sulit dimengerti. Please refer to Silakan merujuk ke original English article artikel asli Inggris whenever possible. bila memungkinkan.
Related Articles Artikel Terkait
- How to Disable Linux and Unix Cron Jobs (Crontab) Email Sending Cara Nonaktifkan Linux dan Unix Cron Jobs (crontab) Mengirim Email
- MySQL Database Performance Tuning Best Practices Video Tutorial Kinerja MySQL Database Tuning Jawaban Praktik Video Tutorial
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Database Aktifkan Logging dari Query Lambat (Slow Permintaan Log) di MySQL Database
- How to Find and Replace Text in MySQL Database using SQL Cara Cari dan Ganti Teks di MySQL Database menggunakan SQL
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 – Part 3 Instalasi Web Server di FreeBSD 6.0 with Apache 2.2, PHP MySQL 5,0 dan 5 - Bagian 3
- Change and Reset MySQL root Password Mengubah dan Reset MySQL root Password
- Remove or Trim First or Last Few Characters in MySQL Database with SQL Menghapus atau Trim Pertama atau Sedikit Terakhir Karakter dalam MySQL Database dengan SQL
- How to Backup and Restore (Export and Import) MySQL Databases Tutorial Cara Backup dan Restore (Ekspor dan Impor) Database MySQL Tutorial
- Reset the Root Password of MySQL Server Reset Password Root di MySQL Server
- Using phpMyAdmin for Effective MySQL Management in Windows XP Menggunakan phpMyAdmin untuk MySQL Manajemen efektif dalam Windows XP










































April 2nd, 2009 09:41 2 Apr 2009 09:41
I'ma newby on managing MySQL. I'ma newby pada mengatur MySQL.
I want to ask you, how to to make sure if the Cron is working? Saya ingin bertanya, bagaimana cara untuk memastikan apakah Cron bekerja?
Thanks Terima kasih
November 16th, 2008 12:48 November 16, 2008 12:48
along the lines of what Zubin is suggesting you can use the –silent(-s) switch as well, so you only get output if there is an error, something like sepanjang baris apa Zubin adalah menyarankan anda dapat menggunakan-diam (s) beralih juga, sehingga Anda hanya mendapatkan output jika ada kesalahan, seperti
MAILTO=email@domain.com Mailto = email@domain.com
0 1 * * * mysqlcheck -Aaos -uroot -ppassword 0 1 * * * mysqlcheck-Aaos-uroot-ppassword
this way you will only get an email if there is an error Dengan cara ini Anda hanya akan mendapatkan email jika ada kesalahan
September 20th, 2008 18:34 September 20, 2008 18:34
Sure mysql does need frequent tunning, and also I have seen a lot of the servers running in the default configuration. Yakin mysql tidak perlu sering tunning, dan saya juga melihat banyak server berjalan di konfigurasi default. which happens to be a very modest one. yang terjadi menjadi sangat sederhana satu. If you have access to the mysql configuration file, there are some values that can make your server breathe more often. Jika Anda memiliki akses ke file konfigurasi mysql, ada beberapa nilai-nilai yang dapat membuat server Anda lebih sering bernafas. And make your visitors more happy. Dan membuat pengunjung lebih senang.
May 6th, 2008 19:15 6 Mei 2008 19:15
I did not know that it was nesessary to perform a regular check for mysql. I didn't know that it was nesessary untuk melakukan rutin memeriksa mysql.
January 16th, 2008 06:40 Januari 16, 2008 06:40
Note that -–auto-repair should have two dashes Perlu diketahui bahwa - auto-perbaikan harus memiliki dua strip
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). Anda juga mungkin ingin meninggalkan "> / dev / null" untuk menjalankan beberapa pertama, untuk melihat hasil perintah (jika anda menaruh mailto = me@mydomain.com di bagian atas crontab, hasil akan mendapatkan dikirim ada).