简体   繁体   中英

How to backup 100 mysql databases at once in localhost?

I have 100 databases in my localhost. I want to backup all of them at once. I want a quick method to do this. Is there anyway to backup all databases at once?

You can dump multiple databases at once with mysqldump .

With the following command you can dump several databases at once.

mysqldump --databases db1 db2 db3 > db_backup.sql

Or if you want to dump all databases:

mysqldump -u root -p --all-databases > db_backup.sql

check this url http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_all-databases . this should help

How to use?

shell> mysqldump [options] --all-databases

You could use mysqldump to create a backup of your mysql databases.

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Try this:

mysqldump -uusername -ppassword --all-databases > all_dbs.sql

Hope this helps!

Its as simple as backing up one single database. Just do as follows

  1. Go to http://localhost/phpmyadmin
  2. Navigate to Export tab
  3. In Export method, choose ' Custom - display all possible options ' and select the database you want to export if not all.
  4. Scroll below and in Object creation options Make sure you select

    • Add CREATE DATABASE / USE statement
    • Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER statement
  5. Click Go and Let all you table be saved in default download folder or select it manually.

  6. Default File name would be 127_0_0_1.sql Make sure you open this file with text editor and verify if sql command is correct, at least for first database and first table. it should be backed up now. If having any Problem in doing so, please leave comment below to ask.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM