How to Backup and Restore (Export and Import) MySQL Databases Tutorial Wie Backup-und Restore (Export und Import) Datenbanken MySQL Tutorial
phpMyAdmin can be used to export or backup MySQL databases easily. phpMyAdmin kann verwendet werden, zu exportieren oder Backup-MySQL-Datenbanken einfach. However, if the database size is very big, it probably won’t be a good idea. Allerdings, wenn die Datenbank-Größe ist sehr groß, es wird wahrscheinlich nicht für eine gute Idee. 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 erlaubt es Benutzern zu speichern Datenbank-Dump-Datei oder als Anzeige auf dem Bildschirm aus, woraus sich Exportieren von SQL-Anweisungen von dem Server, und Übermittlung der Daten über langsamere Netzwerkverbindung oder Internet-Benutzer auf dem 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. Dieser Prozess langsam den ausführenden Prozess, erhöhen Datenbank Locking Zeit und somit MySQL Nichtverfügbarkeit, langsam dem Server und können einfach Absturz des Apache HTTPD-Server, wenn zu viele eingehende Verbindungen Web-hogging das System-Ressourcen.
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. Der bessere Weg, um Backup-und Export MySQL-Datenbank ist, indem Sie die Aufgabe lokal auf dem Server, so dass die Tabellen "Daten können sofort Dumpingpreisen auf der lokalen Platte ohne Verzögerung. Thus export speed will be faster and reduce the time MySQL database or table is locked for accessing. So exportieren Geschwindigkeit wird schneller und Verkürzung der Zeit, MySQL-Datenbank oder Tabelle ist für den Zugriff gesperrt. 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. Dieses Tutorial ist die Anleitung, wie man Backup (Export) und Wiederherstellung (Import) MySQL Datenbank (en) auf dem Datenbank-Server selbst, indem Sie die mysqldump mysql-und Versorgungsunternehmen. 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. Es gibt grundsätzlich zwei Methoden zur Sicherung von MySQL, wird man durch Kopieren alle Tisch-Dateien (*. frm, *. MYD und *. MYI-Dateien) oder durch die Verwendung mysqlhotcopy Nutzen, aber es funktioniert nur bei MyISAM-Tabellen. Below tutorial will concentrate on mysqldump which works for both MyISAM and InnoDB tables. Unten Tutorial wird sich auf mysqldump der Werke für beide MyISAM-und InnoDB-Tabellen.
How to Export or Backup or Dump A MySQL Database Wie zum Export oder Backup oder Dump einer MySQL-Datenbank
To export a MySQL database into a dump file, simply type the following command syntax in the shell. So exportieren Sie eine MySQL-Datenbank in eine Dump-Datei, geben Sie einfach die folgende Befehlssyntax in der Außenhaut. You can use Telnet or SSH to remotely login to the machine if you don’t have access to the physical box. Sie können Telnet oder SSH remote login auf der Maschine, wenn Sie keinen Zugriff auf die physischen Feld.
mysqldump -u username -p password database_name > dump.sql mysqldump-u username-p Passwort 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. Ersetzen Sie username mit einem gültigen MySQL-Benutzer-ID, Passwort, mit dem gültigen Passwort für den Benutzer (WICHTIG: keine Leerzeichen nach-p und dem Passwort, sonst mysqldump werden Sie das Passwort noch zu behandeln wie das Passwort-Datenbank Namen, so dass die Backup scheitert ) Und der Datenbankname mit den eigentlichen Namen der Datenbank, die Sie exportieren wollen. Finally, you can put whatever name you like for the output SQL dump file, here been dump.sql . Schließlich können Sie einen beliebigen Namen, den Sie wie für die Ausgabe von SQL-Dump-Datei, hier wurden 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. Die while Daten, Tabellen, die Strukturen und die Datenbank der Datenbankname werden gesichert werden in einer SQL-Textdatei mit dem Namen dump.sql mit den oben genannten Befehl.
How to Export A MySQL Database Structures Only Wie zur Ausfuhr einer MySQL-Datenbank-Strukturen nur
If you no longer need the data inside the database’s tables (unlikely), simply add –no-data switch to export only the tables’ structures. Wenn Sie nicht mehr brauchen die Daten innerhalb der Datenbank-Tabellen (eher unwahrscheinlichen), fügen Sie einfach-no-Schalter Daten zu exportieren nur die Tabellen "Strukturen. For example, the syntax is: Zum Beispiel ist die Syntax:
mysqldump -u username -p password –no-data database_name > dump.sql mysqldump-u username-p Passwort-no-Daten database_name> dump.sql
How to Backup Only Data of a MySQL Database Wie Nur Backup von Daten einer MySQL-Datenbank
If you only want the data to be backed up, use –no-create-info option. Wenn Sie nur wollen, dass die Daten gesichert werden, verwenden Sie-no-create-info Option. With this setting, the dump will not re-create the database, tables, fields, and other structures when importing. Mit dieser Einstellung wird der Dump nicht neu erstellen der Datenbank, Tabellen, Felder und anderen Strukturen bei der Einfuhr. Use this only if you pretty sure that you have a duplicate databases with same structure, where you only need to refresh the data. Verwenden Sie diese nur, wenn Sie ziemlich sicher, dass Sie über ein Duplikat Datenbanken mit derselben Struktur, wo Sie müssen nur die Daten aktualisieren.
mysqldump -u username -p password –no-create-info database_name > dump.sql mysqldump-u username-p Passwort-no-create-info database_name> dump.sql
How to Dump Several MySQL Databases into Text File How to dump mehrere MySQL-Datenbanken in Text-Datei
–databases option allows you to specify more than 1 database. Datenbanken-Option ermöglicht es Ihnen, mehr als 1 Datenbank. Example syntax: Beispiel Syntax:
mysqldump -u username -p password –databases db_name1 [db_name2 ...] > dump.sql mysqldump-u username-p Passwort-Datenbanken db_name1 [db_name2 ...]> dump.sql
How to Dump All Databases in MySQL Server Wie zu dumpen alle Datenbanken in den MySQL-Server
To dump all databases, use the –all-databases option, and no databases’ name need to be specified anymore. Dumpen alle Datenbanken, verwenden Sie das-alles-Datenbanken Option, und keine Datenbanken 'name müssen angegeben werden mehr.
mysqldump -u username -p password –all-databases > dump.sql mysqldump-u username-p Passwort-all-databases> dump.sql
How to Online Backup InnoDB Tables Wie zu Online-Backup-InnoDB-Tabellen
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 der Datenbank unvermeidlich dazu führen, dass MySQL-Server-Anwendungen nicht zur Verfügung stehen, da beim Export, alle Tabellen erworben eine globale Lesesperre mit FLUSH TABLES WITH READ LOCK zu Beginn des Dump bis zum Ende. 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. Und obwohl LESEN Aussagen können, werden alle INSERT, UPDATE und DELETE-Anweisungen müssen die Warteschlange aufgrund Tabellen gesperrt, als ob MySQL ist oder ins Stocken geraten. 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. Wenn Sie InnoDB-single-Transaktion ist der Weg zur Minimierung dieser Zeit Sperren Dauer von fast nicht existent, als ob die Durchführung einer Online-Sicherung. It works by reading the binary log coordinates as soon as the lock has been acquired, and lock is then immediately released. Es funktioniert durch das Lesen der Binär-Log-Koordinaten, sobald die Sperre erworben worden, und Sperre wird dann sofort freigegeben.
Syntax:
mysqldump -u username -p password –all-databases –single-transaction > dump.sql mysqldump-u username-p Passwort-all-Datenbanken-single-transaction> dump.sql
How to Restore and Import MySQL Database Wie wiederherstellen und MySQL-Datenbank importieren
You can restore from phpMyAdmin, using Import tab. Sie können von phpMyAdmin, durch Importieren ". 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. Für schnellere Weg, die Upload-Dump-Datei mit dem MySQL-Server, und verwenden Sie den folgenden Befehl zum Importieren der Datenbanken zurück in den MySQL-Server.
mysql -u username -p password database_name < dump.sql mysql-u username-p Passwort 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. Die Import-und Export von MySQL-Datenbank ist nicht nur wichtig, um die Daten bei Katastrophen, sondern bietet auch einen einfachen Weg zu migrieren oder verschieben auf einen anderen Server, wie beispielsweise beim Schalten Web Hosting Provider. However, do note that one common problem - character set encoding. Hingegen zögern Sie nicht, dass ein gemeinsames Problem - Zeichensatz-Codierung. 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. Neuere Version von mysqldump benutzt UTF8 als Standard-Zeichensatz, wenn nichts angegeben wird, während ältere Versionen (älter als typisch 4,1) für die Nutzung Latin1 als Standard-Zeichensatz. 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). Wenn Sie Datenbank-Zeichensatz ist latin1 und Dump in UTF8 Sortierung können die Daten bis zum Ende einfach Müll, verstümmelt oder unlesbar (häufig geschieht mit Wordpress Blog). If this case, use –default-character-set=charset_name option to specify the character set or Wenn dieser Fall, verwenden Sie-default-character-set = charset_name Option, um den Zeichensatz oder convert the database to UTF8 konvertieren die Datenbank auf UTF8 .
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. WICHTIG: Es handelt sich um eine Maschine der Seite übersetzt wird "as is" ohne Garantie. Machine translation may be difficult to understand. Maschinelle Übersetzung ist vielleicht schwierig zu verstehen. Please refer to Bitte wenden Sie sich an original English article Original Englisch Artikel whenever possible. wann immer dies möglich ist.
Share and contribute or get technical support and help at Aktie und einen Beitrag oder erhalten technische Unterstützung und Hilfe an My Digital Life Forums Meine digitalen Lebens Foren .
Related Articles Verwandte Artikel
- Restore Full Backup or cpmove File in cPanel Web Host Restore Full Backup oder cpmove Datei in cPanel Web Host
- How to Export Firefox Bookmarks to IE Internet Explorer Favorites (or Import From) Wie Exportieren von Lesezeichen für Firefox IE Internet Explorer Favorites (Aus-oder Einfuhr)
- IMP-00013 Oracle Import Error IMP-00013 Oracle-Import-Fehler
- IMP-00016 Required Character Set Conversion Not Supported Error when Import to Oracle Database IMP-00016 erforderlich Zeichensatz Konvertierung nicht unterstützt und Fehler bei der Einfuhr in die Oracle-Datenbank
- Check and Optimize MySQL Database Automatically with Crontab/Cron Prüfen und Optimieren von MySQL-Datenbank automatisch mit crontab / cron
- MySQL Database Performance Tuning Best Practices Video Tutorial MySQL-Datenbank-Performance Tuning Best Practices Video-Tutorial
- Export, Backup or Copy Out the IE7 Search Providers List Export, Backup oder kopieren Sie die Suche IE7 Anbieter Liste
- Oracle EXP-00091 Error When Export Database Oracle exp-00091-Fehler angezeigt, wenn Datenbank exportieren
- Backup an iTunes Playlist Backup eine iTunes Wiedergabeliste
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3 Installation von Web-Server in FreeBSD 6,0 mit Apache 2,2, 5,0 MySQL und PHP 5 - Teil 3

































January 26th, 2008 01:32 26. Januar 2008 01:32
Nice post.. Post-Nizza .. I usually just copy the files.. Ich normalerweise nur kopieren Sie die Dateien .. for temporary.. für die vorübergehende .. and get all mysql queries for permanent backup.. und erhalten Sie alle MySQL-Abfragen für die endgültige Sicherung ..
February 4th, 2008 12:48 4. Februar 2008 12:48
It shows how to backup all-databases… but how to restore all of them at once from the same file? Es zeigt, wie man alle Backup-Datenbanken… aber wie zur Wiederherstellung aller von ihnen auf einmal von der gleichen Datei? … 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) … Ich habe versucht die Wiederherstellung der gleichen Art und Weise, sondern erhalten eine msg: unbekannt Datenbank: All-Datenbanken (ich habe es geschafft, bevor ich aber vergessen, es hat sich eine Weile… Ich werde sie alle umschauen)
February 4th, 2008 13:17 4. Februar 2008 13:17
mysql -u root -p < all-databases.sql mysql-u root-p <Alle-databases.sql
done. getan.
February 6th, 2008 03:43 6. Februar 2008 03:43
mysqldump worked. mysqldump arbeitete.
But ‘mysql’ to import data did not. Aber "mysql" zu importieren Daten nicht. The error is: Die Fehlermeldung lautet:
ERROR at line 1: Unknown command ‘\m’ FEHLER in Zeile 1: Unknown command '\ m'
any ideas? irgendwelche Ideen?
February 16th, 2008 02:46 16. Februar 2008 02:46
thanks alot .. vielen Dank .. you saved my time and money both .. Sie gespeichert meine Zeit und Geld beide .. hat off to you . Hut ab für Sie.
April 14th, 2008 16:31 14. April 2008 16:31
Good post. Gute Post. But you can add some advanced tips to it, to make it better. Aber können Sie einige weiterführende Hinweise darauf, dass es besser machen. Goog luck! GOOG Glück!
May 27th, 2008 23:45 27. Mai 2008 23:45
Good post, but what about backing up the mysql users them selves? Gute Post, aber was ist das Sichern der MySQL-Benutzern ihnen selbst?
July 21st, 2008 07:57 21. Jul 2008 07:57
[...] Enlace [...] Enlace [...] [...]
September 4th, 2008 17:24 4. September 2008 17:24
ciao sto cercando di effettuare il backup in locale su vista e iis 7.0 ciao sto cercando di effettuare il locale Backup in su vista e iis 7,0
eseguo questo file php eseguo questo PHP-Datei
db.sql
?>
ma mi restituisce il seguente errore ma mi restituisce il seguente errore
Parse error: syntax error, unexpected T_DEC in C:\inetpub\wwwroot\back.php on line 2 Parse error: syntax error, unexpected T_DEC in C: \ inetpub \ wwwroot \ back.php on line 2
qualche consiglio? qualche Consiglio?
grazie, daniele. Grazie, Daniele.