Linux & MySQL: Backup per Konsole erstellen und einspielen

This post was published 11 years 4 months 25 days ago, so the post may be outdated.

Mit zwei kurzen kurzen Linux Befehlen kann man seine MySQL Datenbank in eine SQL Datei speichern und auch wieder importieren lassen.

Backup erstellen:
mysqldump -u root -p --all-databases --result-file=dbdata.sql

Zum importieren:
mysql -u root -p < dbdata.sql

Sobald man den Befehl ausführt, muss man auch noch das Passwort des Benutzers angeben.
Achtung: Auch die Benutzer werden dabei dann exportiert und auch beim Import überschrieben!

Patrik Kernstock

May I introduce my self? I am Patrik Kernstock, 25 years old, perfectionist, born in Austria and living in Ireland, Cork. Me explained in short: Tech- and security enthusiast, series & movies junky. Interesting in Linux, Container-stuff and many software solutions by Microsoft, Veeam and VMware.

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
newest
oldest most voted
Inline Feedbacks
View all comments
Marco Näf

Diesen Befehl suche ich auch immer wieder.

Villeicht kannst du noch dazuschreiben, dass man das Passwort gleich mit
mysqldump -u root -pPASSWORT –all-databases –result-file=dbdata.sql
übergeben kann.

Gruss Marco

1
0
Would love your thoughts, please comment.x
()
x