Check and Optimize MySQL Database Automatically with Crontab/Cron Controllare e ottimizzare i database MySQL automaticamente con crontab / cron
MySQL is a very popular free yet powerful database system. MySQL è un libero molto popolare ancora potente sistema di basi di dati. 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. Ma anche in grandi basi di dati, le tabelle possono ottenere con lavagna frammentato a causa di continuo aggiornamento, eliminare o inserire funzionamento e sui dati memorizzati nel database. Beside, it’s also possibility that the databases may get corrupted. Accanto, è anche possibile che il database può ottenere danneggiato. Thus, performing health check on database and optimize MySQL server regularly is an important task. Quindi, eseguire controllo sanitario su base di dati e ottimizzare regolarmente server MySQL è un compito importante.
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. È un po 'fastidioso se il database per gli amministratori hanno accesso al server o il lancio di phpMyAdmin per ottimizzare le basi di dati uno dopo l'altro o da tavolo tabella manualmente. Sometimes DB admin may simply forgets to do the job or set the frequency of optimization to lesser times. Talvolta PB amministratore può semplicemente dimentica di fare il proprio lavoro o per impostare la frequenza di ottimizzazione a volte minore. It’s recommended that every tables in MySQL databases are checked at least once a day on a busy server. E 'raccomandato che tutti i tavoli in basi di dati di MySQL sono controllati almeno una volta al giorno su un server occupato.
It’s possible to automate the optimization of MySQL process by using crontab function in Linux/Unix/CentOS/FreeBSD. E 'possibile automatizzare l'ottimizzazione del processo di MySQL tramite crontab in funzione 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. Il job di cron per controllare e ottimizzare le basi di dati di MySQL può essere creato utilizzando mysqlcheck cliente viene utilità di installazione di MySQL. mysqlcheck client can checks, repairs, optimizes, and analyzes tables in MySQL database. mysqlcheck client è in grado di controlli, riparazioni, ottimizza, e analizza le tabelle di cui al 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. Per creare un nuovo job in cron, effettua il login al server come utente root o di qualsiasi altro utente, e quindi modificare il file crontab (nella maggior parte dei sistemi operativi, crontab-e si aprirà nel file crontab di default editor di testo) per aggiungere nella seguente riga di testo . For users using cPanel, click on “Cron job” where you can set up crontab at daily, hourly and other interval. Per gli utenti che utilizzano cPanel, fai clic su "cron job" dove è possibile impostare fino a crontab ogni giorno, orari e altre intervallo. Experience webmasters can also set up a crontab file in rc.hourly or rc.daily or other cron directory. L'esperienza webmaster possono anche creare un file crontab in rc.hourly o rc.daily o di altre directory di 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. Si noti che se il login come MySQL o utente normale, senza privilegi di accesso a tutti i database, non è possibile ottimizzare tutti i database, a meno che l'ID utente e la password per l'utente root è specificato come nel seguente esempio.
0 1 * * * mysqlcheck -Aao –auto-repair -u root -p[password] > /dev/null 0 1 * * * mysqlcheck-Aao-auto-riparazione-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. La dichiarazione di cui sopra ha la sintassi simile a "mysqlcheck [opzioni]-tutte-le banche dati", dove-tutto-basi di dati parametro è l'azione predefinita è basi di dati non è specificato quindi può essere omessa. The command will run mysqlcheck client to automatically analyze and optimize all databases at 1 am everyday. Il comando verrà eseguito mysqlcheck cliente automaticamente analizzare e ottimizzare tutti i database a 1 sono tutti i giorni. Note that there is not space between -p and your password for root. Si noti che non vi è spazio tra-p e la tua password di root. You can change the running time to your preference, and also change the options for mysqlcheck command. È possibile modificare il tempo a proprio piacimento, e anche modificare le opzioni per mysqlcheck comando. If you just want to check and optimize certain databases or certain tables without the database, use the following syntax: Se si desidera solo per controllare e ottimizzare alcune basi di dati o di alcuni tavoli senza la base di dati, utilizzare la seguente sintassi:
mysqlcheck [options] db_name [tables] mysqlcheck [opzioni] db_name [tabelle]
mysqlcheck [options] –databases DB1 [DB2 DB3...] mysqlcheck [opzioni]-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. Potreste voler rimuovere-auto-riparazione passare da sopra il comando, come un tavolo di riparazione operazione potrebbe causare la perdita di dati in alcune circostanze l'operazione a causa di cause includono ma non sono limitati a filesystem di errori. For those who has changed the character set and collation of MySQL databases may also need to use –default-character-set option. Per chi ha cambiato il set di caratteri e la collation del database MySQL può inoltre bisogno di usare di default caratteri-set opzione. More information on all available switches and options available can be found Maggiori informazioni su tutte le opzioni disponibili e le opzioni disponibili può essere trovato here qui .
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Questa è una macchina tradotto pagina che è fornito "così come sono" senza garanzia. Machine translation may be difficult to understand. La traduzione automatica può essere difficile da capire. Please refer to Si prega di fare riferimento a original English article articolo originale in inglese whenever possible. ogniqualvolta ciò sia possibile.
Share and contribute or get technical support and help at Condividere e contribuire o ottenere supporto tecnico e contribuire a My Digital Life Forums La mia vita digitale forum .
Related Articles Articoli correlati
- MySQL Database Performance Tuning Best Practices Video Tutorial Database MySQL di tuning delle prestazioni migliori pratiche video tutorial
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 Installare server Web in Windows XP con Apache2 PHP5 e MySQL4 - Parte 4
- Change and Reset MySQL root Password Cambiamento e di ripristino della password di root di MySQL
- How to Find and Replace Text in MySQL Database using SQL Come Trova e Sostituisci il testo negli Database MySQL utilizza SQL
- WordPress MySQL SQL Query Error in WPDB Class WordPress MySQL query SQL errore nella classe WPDB
- Change or Set MySQL Long Query Time Value for log-slow-queries Cambia o Imposta a lungo MySQL Query valore di log-lento-query
- Using PHP-MySQL Persistent Connections to Run WordPress Blog Utilizzo di PHP-MySQL connessioni persistenti a correre WordPress Blog
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Database Attivare la registrazione di Slow Query (Slow Query Log) nel Database MySQL
- How to Delete Existing WordPress Post Revisions Stored/Saved Come eliminare i post wordpress revisioni memorizzati / salvato
- Remove or Trim First or Last Few Characters in MySQL Database with SQL Rimuovere o Trim prima o l'ultima pochi caratteri a MySQL database con SQL

































January 16th, 2008 06:40 16 gennaio 2008 06:40
Note that -–auto-repair should have two dashes Si noti che - auto-riparazione deve avere due trattini
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). Inoltre, si potrebbe desiderare di lasciare "> / dev / null" per le prime corse, per vedere i risultati del comando (se metti MAILTO = me@mydomain.com nella parte superiore della crontab, i risultati avranno ci ha inviato).
May 6th, 2008 19:15 6 maggio 2008 19:15
I did not know that it was nesessary to perform a regular check for mysql. Non sapevo che era nesessary per eseguire un controllo regolare per mysql.
September 20th, 2008 18:34 20 settembre 2008 18:34
Sure mysql does need frequent tunning, and also I have seen a lot of the servers running in the default configuration. Certo non mysql necessità Tunning frequenti, e inoltre ho visto un sacco di server in esecuzione in configurazione di default. which happens to be a very modest one. che succede ad essere molto modesto. If you have access to the mysql configuration file, there are some values that can make your server breathe more often. Se si ha accesso al file di configurazione di MySQL, ci sono alcuni valori che possono rendere il vostro server di respirare più spesso. And make your visitors more happy. E fare i tuoi visitatori più felice.