How to Backup and Restore (Export and Import) MySQL Databases Tutorial Come fare il backup e ripristino (esportazione e importazione) basi di dati di MySQL Tutorial

phpMyAdmin can be used to export or backup MySQL databases easily. phpMyAdmin può essere utilizzato per l'esportazione di backup o di basi di dati di MySQL facilmente. However, if the database size is very big, it probably won’t be a good idea. Tuttavia, se le dimensioni del database è molto grande, probabilmente non sarà una buona idea. phpMyAdmin allows users to save database dump as file or display on screen, which involves exporting SQL statements from the server, and transmitting the data across slower network connection or Internet to user’s computer. phpMyAdmin permette agli utenti di salvare il dump di database come file o la visualizzazione sullo schermo, che coinvolge esportatori dichiarazioni di SQL server, e la trasmissione di dati attraverso la connessione di rete lenta o Internet con il tuo computer. This process slow the exporting process, increase database locking time and thus MySQL unavailability, slow the server and may simply crash the Apache HTTPD server if too many incoming web connections hogging the system’s resources. Questo processo lento processo di esportazione, aumentare la banca dati di bloccaggio tempo e, quindi, MySQL indisponibilità, lento il server e può semplicemente in crash il server httpd Apache, se troppe connessioni in entrata web monopolizzavano il sistema delle risorse.

The better way to backup and export MySQL database is by doing the task locally on the server, so that the tables’ data can be instantly dumped on the local disk without delay. Il modo migliore di backup e di esportazione database MySQL è di fare il compito localmente sul server, in modo che le tabelle 'dati possono essere immediatamente oggetto di dumping sul disco locale senza indugio. Thus export speed will be faster and reduce the time MySQL database or table is locked for accessing. Così la velocità di esportazione sarà più veloce e ridurre il tempo di MySQL database o una tabella è bloccata per l'accesso. This tutorial is the guide on how to backup (export) and restore (import) MySQL database(s) on the database server itself by using the mysqldump and mysql utilities. Questo tutorial è una guida su come effettuare il backup (esportazione) e ripristinare (importazione) database MySQL (s) sul server di database stesso utilizzando il mysql mysqldump e servizi di pubblica utilità. There are basically two methods to backup MySQL, one is by copying all table files (*.frm, *.MYD, and *.MYI files) or by using mysqlhotcopy utility, but it only works for MyISAM tables. Ci sono fondamentalmente due metodi per effettuare il backup di MySQL, si è di copiare tutti i file di tabella (*. frm, *. MYD, e file *. MYI), o utilizzando mysqlhotcopy utilità, ma funziona solo per le tabelle MyISAM. Below tutorial will concentrate on mysqldump which works for both MyISAM and InnoDB tables. Qui di seguito esercitazione si concentrerà sulla mysqldump che lavora per entrambe le MyISAM e le tabelle InnoDB.

How to Export or Backup or Dump A MySQL Database Come esportare o di backup o di dump un database MySQL

To export a MySQL database into a dump file, simply type the following command syntax in the shell. Per esportare un database MySQL in un file, basta digitare il seguente sintassi del comando nella shell. You can use Telnet or SSH to remotely login to the machine if you don’t have access to the physical box. È possibile utilizzare Telnet o SSH per accesso remoto alla macchina se non hai accesso fisico ai box.

mysqldump -u username -p password database_name > dump.sql mysqldump-u-p nome utente password database_name> dump.sql

Replace username with a valid MySQL user ID, password with the valid password for the user (IMPORTANT: no space after -p and the password, else mysqldump will prompt you for password yet will treat the password as database name, so the backup will fail) and database_name with the actual name of the database you want to export. Sostituire con un nome utente valido MySQL ID utente, password con la password valida per l'utente (IMPORTANTE: nessuno spazio dopo-p e la password, altrimenti mysqldump vi verrà chiesto la password per tratterà ancora la password, come nome del database, in modo che il backup non andrà a buon fine ) E database_name con il nome effettivo della banca dati che si desidera esportare. Finally, you can put whatever name you like for the output SQL dump file, here been dump.sql . Infine, è possibile immettere qualsiasi nome che ti piace di output per il file di SQL, qui è dump.sql.

The while data, tables, structures and database of database_name will be backed up into a SQL text file named dump.sql with the above command. Mentre i dati, le tabelle, le strutture e la base dati di database_name verrà eseguito il backup di SQL in un file di testo chiamato dump.sql con il comando precedente.

How to Export A MySQL Database Structures Only Come esportare un database MySQL strutture solo

If you no longer need the data inside the database’s tables (unlikely), simply add –no-data switch to export only the tables’ structures. Se non hai più bisogno di dati all'interno delle tabelle del database (improbabile), è sufficiente aggiungere-no-dati passare ad esportare solo le tabelle 'strutture. For example, the syntax is: Per esempio, la sintassi è la seguente:

mysqldump -u username -p password –no-data database_name > dump.sql mysqldump-u nome utente-p password-no-dati database_name> dump.sql

How to Backup Only Data of a MySQL Database Come fare il backup solo dei dati di un database MySQL

If you only want the data to be backed up, use –no-create-info option. Se si desidera solo i dati di cui eseguire il backup, usa-no-creare-info opzione. With this setting, the dump will not re-create the database, tables, fields, and other structures when importing. Con questa impostazione, la discarica non ri-creare il database, le tabelle, i campi, e di altre strutture per l'importazione. Use this only if you pretty sure that you have a duplicate databases with same structure, where you only need to refresh the data. Utilizzare questo solo se è sicuro che avete un duplicato basi di dati con la stessa struttura, in cui hai solo bisogno di aggiornare i dati.

mysqldump -u username -p password –no-create-info database_name > dump.sql mysqldump-u nome utente-p password-no-creare-info database_name> dump.sql

How to Dump Several MySQL Databases into Text File Come dump diverse basi di dati di MySQL in file di testo

–databases option allows you to specify more than 1 database. - Basi di dati opzione consente di specificare più di 1 banca dati. Example syntax: Esempio di sintassi:

mysqldump -u username -p password –databases db_name1 [db_name2 ...] > dump.sql mysqldump-u-p nome utente password banche dati db_name1 [db_name2 ...]> dump.sql

How to Dump All Databases in MySQL Server Come dump in tutti i database server MySQL

To dump all databases, use the –all-databases option, and no databases’ name need to be specified anymore. Per riversare tutti i database, usa il-all-opzione banche dati, banche dati e nessun 'nome devono essere specificati più.

mysqldump -u username -p password –all-databases > dump.sql mysqldump-u nome utente-p password-tutti i basi di dati-> dump.sql

How to Online Backup InnoDB Tables Come Online Backup le tabelle InnoDB

Backup the database inevitable cause MySQL server unavailable to applications because when exporting, all tables acquired a global read lock using FLUSH TABLES WITH READ LOCK at the beginning of the dump until finish. Backup del database inevitabile causa server MySQL non disponibile per le applicazioni perché quando esportatori, tutte le tabelle acquisito una lettura globale di blocco utilizzando tabelle con FLUSH LEGGERE BLOC all'inizio della discarica fino al traguardo. So although READ statements can proceed, all INSERT, UPDATE and DELETE statements will have to queue due to locked tables, as if MySQL is down or stalled. Anche se in modo LEGGERE dichiarazioni possono procedere, tutti i INSERT, UPDATE e DELETE dichiarazioni dovranno coda bloccato a causa di tabelle, come se MySQL è giù o situazione di stallo. If you’re using InnoDB, –single-transaction is the way to minimize this locking time duration to almost non-existent as if performing an online backup. Se si sta utilizzando InnoDB,-unica operazione-è il modo per ridurre al minimo il tempo di bloccaggio durata di quasi inesistente come se eseguire un backup in linea. It works by reading the binary log coordinates as soon as the lock has been acquired, and lock is then immediately released. Funziona leggendo le coordinate di log binario non appena il blocco è stato acquisito, e bloccare quindi è immediatamente svincolata.

Syntax: Sintassi:

mysqldump -u username -p password –all-databases –single-transaction > dump.sql mysqldump-u nome utente-p password-tutti i database-single-transazione> dump.sql

How to Restore and Import MySQL Database Come ripristinare e importazione database MySQL

You can restore from phpMyAdmin, using Import tab. È possibile ripristinare da phpMyAdmin, mediante importazione scheda. For faster way, upload the dump file to the MySQL server, and use the following command to import the databases back into the MySQL server. Per il modo più veloce, caricare il file al server MySQL, e usare il seguente comando per importare il database indietro nel server MySQL.

mysql -u username -p password database_name < dump.sql mysql-u-p nome utente password database_name <dump.sql

The import and export of MySQL database not only is important to recover the data when disaster strikes, but also provides an easy way to migrate or move to another server, such as when switching web hosting providers. L'importazione e l'esportazione di database MySQL non solo è importante per recuperare i dati quando il disastro colpisce, ma anche fornisce un modo semplice per migrare o per passare a un altro server, come ad esempio quando si passa di web hosting provider. However, do note that one common problem - character set encoding. Tuttavia, nota che uno problema comune - set di caratteri di codifica. Newer release of mysqldump uses UTF8 as its default charset if nothing is specified, while older versions (older than 4.1 typically) use Latin1 as default characterset. Più recente release di mysqldump usa UTF8 come impostazione predefinita charset se nulla è specificato, mentre le versioni più vecchie (di età superiore a 4,1 tipicamente) Latin1 utilizzare come impostazione predefinita characterset. If you database charset is Latin1 and dump in UTF8 collation, the data may ends up become simply rubbish, garbled, or unreadable (frequently happen with Wordpress blog). Se si è banca dati charset Latin1 e dump in UTF8 raccolta, i dati possono finisce per diventare semplicemente spazzatura, incomprensibile, o illeggibile (spesso accadere con Wordpress blog). If this case, use –default-character-set=charset_name option to specify the character set or Se questo caso, l'uso di caratteri di default-set = charset_name opzione per specificare il set di caratteri o convert the database to UTF8 convertire il database per UTF8 .

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Questa è una pagina tradotta macchina che è fornito "così com'è" senza alcuna garanzia. Machine translation may be difficult to understand. Traduzione automatica può essere difficile da capire. Please refer to Si prega di fare riferimento a original English article articolo originale in lingua inglese whenever possible. quando possibile.

Share and contribute or get technical support and help at Condividere e contribuire o ottenere supporto tecnico e assistenza in My Digital Life Forums La mia vita digitale Forum .



8 Responses to “How to Backup and Restore (Export and Import) MySQL Databases Tutorial” 8 Risposte a "Come fare il backup e ripristino (esportazione e importazione) basi di dati di MySQL Tutorial"

  1. johnrobin
    January 26th, 2008 01:32 26 gennaio 2008 01:32
    1

    Nice post.. Nice post .. I usually just copy the files.. Di solito basta copiare il file .. for temporary.. per la temporanea .. and get all mysql queries for permanent backup.. e ottenere tutti i mysql query per il backup permanente ..

  2. ferensick
    February 4th, 2008 12:48 4 febbraio 2008 12:48
    2

    It shows how to backup all-databases… but how to restore all of them at once from the same file? Essa indica il modo di backup di tutti i database-… ma come ripristinare tutti loro in una sola volta dallo stesso file? … I tried restoring the same way but receive a msg: unknown database: all-databases (I’ve done it before but I forget, it’s been a while… I’ll keep looking around) … Ho cercato di ripristinare allo stesso modo ma ricevere un msg: sconosciuto banca dati: tutti i dati (ho fatto prima, ma ho dimenticato, è stato un po 'di tempo… I'll mantenere guardandosi intorno)

  3. ferensick
    February 4th, 2008 13:17 4 febbraio 2008 13:17
    3

    mysql -u root -p < all-databases.sql mysql-u root-p <-tutti i databases.sql
    done. fatto. :-)

  4. tc TC
    February 6th, 2008 03:43 6 febbraio 2008 03:43
    4

    mysqldump worked. mysqldump lavorato.

    But ‘mysql’ to import data did not. Ma 'mysql' di importare i dati non. The error is: L'errore è:
    ERROR at line 1: Unknown command ‘\m’ ERRORE alla riga 1: Sconosciuto comando '\ m'

    any ideas? tutte le idee?

  5. Mohammod Nizam Uddin Mohammod Nizam Uddin
    February 16th, 2008 02:46 16 febbraio 2008 02:46
    5

    thanks alot .. grazie molte .. you saved my time and money both .. hai salvato il mio tempo e denaro sia .. hat off to you . cappello largo a te.

  6. peanut arachidi
    April 14th, 2008 16:31 14 aprile 2008 16:31
    6

    Good post. Buon post. But you can add some advanced tips to it, to make it better. Ma è possibile aggiungere alcuni suggerimenti avanzati ad esso, per migliorare il servizio. Goog luck! Goog fortuna!

  7. tarot tarocchi
    May 27th, 2008 23:45 27 maggio 2008 23:45
    7

    Good post, but what about backing up the mysql users them selves? Buon posto, ma quello che circa il backup di mysql utenti loro stessi?

  8. Importar datos de MySQL de latin1 a UTF8 « Yvoictra Blog Importar dati di MySQL de latin1 uno UTF8 «Yvoictra Blog
    July 21st, 2008 07:57 21 luglio 2008 07:57
    8

    [...] Enlace [...] Enlace [...] [...]

Leave a Reply Lasciare una risposta

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> È possibile utilizzare questi tag: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q Cite=""> <strike> <strong>

Subscribe without commenting Iscriviti senza commentare


Custom Search

New Articles Nuovi articoli

Incoming Search Terms for the Article Cerca in arrivo Condizioni per l'articolo

mysqldump restore mysqldump ripristinare - -- mysqldump import mysqldump importazione - -- mysqldump utf8 mysqldump utf8 - -- mysqldump encoding mysqldump codifica - -- mysql export database esportazione di database MySQL - -- mysqldump tutorial mysqldump tutorial - -- mysql export MySQL esportazione - -- mysqldump syntax mysqldump sintassi - -- mysql export utf8 MySQL esportazione utf8 - -- mysql export syntax MySQL esportazione sintassi - -- mysqldump recover mysqldump recuperare - -- mySQL import dump MySQL Import dump - -- mysql import utf8 MySQL importazione utf8 - -- mysql import charset MySQL importazione charset - -- mysql import backup MySQL importazione di backup - -- import mysqldump importazione mysqldump - -- mysql export charset MySQL esportazione charset - -- phpmyadmin export encoding phpMyAdmin esportazione di codifica - -- mysqldump slow mysqldump lento - -- mysql import syntax MySQL importazione sintassi - -- phpmyadmin export utf8 phpMyAdmin esportazione utf8 - -- mysqldump example mysqldump esempio - -- mysqldump restore windows mysqldump ripristino di Windows - -- mysql export dump MySQL esportazione dump - -- export mysql esportazione MySQL - -- phpMyAdmin export charset phpMyAdmin esportazione charset - -- mysql import all databases MySQL importare tutti i database - -- mirakagi tutorial mirakagi tutorial - -- restore mysqldump ripristinare mysqldump - -- mysql export encoding MySQL esportazione di codifica - -- all tutto - -- phpmyadmin export tutorial phpMyAdmin esportazione tutorial - -- mysql import encoding MySQL importazione di codifica - -- mysql restore utf8 MySQL ripristinare utf8 - -- mysql import MySQL importazione - -- mysql import slow MySQL importazione lento - -- phpmyadmin export utf-8 phpMyAdmin esportazione UTF-8 - -- export mysql database esportazione database MySQL - -- import mysql database importazione database MySQL - -- mysql import collation MySQL importazione collazione - -- mysql import database importazione database MySQL - -- mysql import all-databases MySQL-importare tutti i database - -- import mysql importazione MySQL - -- mysqldump utf-8 mysqldump UTF-8 - -- mysqldump syntax import mysqldump sintassi importazione - -- mysqldump restore example mysqldump ripristinare esempio - -- mysql export table MySQL tabella di esportazione - -- mysqldump utf mysqldump UTF - -- restore data from mysqldump ripristinare i dati da mysqldump - -- import mysql backup MySQL importazione di backup - -- mysql export utf-8 MySQL esportazione UTF-8 - -- mysql import database dump importazione database MySQL dump - -- mysqldump import all databases mysqldump importare tutti i database - -- import mysql dump importazione MySQL dump - -- mysql export innodb MySQL InnoDB esportazione - -- mysql restore charset MySQL ripristinare charset - -- mysqldump import export mysqldump import export - -- mysqldump restore data mysqldump ripristino dei dati - -- mysqldump restore table mysqldump ripristinare la tabella - -- mysql export import MySQL esportazione importazione - -- import database dump importazione database dump - -- mysql import character set MySQL importazione set di caratteri - -- restore mysqldump windows mysqldump ripristinare Windows - -- mysql restore MySQL ripristinare - -- phpmyadmin export phpMyAdmin esportazione - -- mysql import dump charset MySQL importazione dump charset - -- import mysqldump file importazione di file mysqldump - -- mysqldump export table mysqldump tabella di esportazione - -- phpmyadmin export latin1 phpMyAdmin esportazione latin1 - -- restore mysql dump ssh ripristinare MySQL dump SSH - -- mysql restore all databases MySQL ripristinare tutti i database - -- mysql export tutorial MySQL esportazione tutorial - -- phpmyadmin export character set phpMyAdmin esportazione set di caratteri - -- mysql import mysqldump MySQL importazione mysqldump - -- mysqldump examples mysqldump esempi - --