MySQL backup database

后端 未结 8 1622
情深已故
情深已故 2021-01-06 23:56

I tried to backup the database from my mysql server.

I am using MYSQL 5.5.

I used the following Command to backup the database.

            $         


        
相关标签:
8条回答
  • 2021-01-07 00:23

    try with this in command prompt not in mysql prompt

     mysqldump -u root -p admin project > projectbackup.sql
    

    Docs

    0 讨论(0)
  • 2021-01-07 00:28

    From what I remember, mysqldump is a program, not a MySQL command. Run it from the Windows command prompt instead of the MySQL prompt. Also, don't include the $ dollar sign.

    Also you'll need to include the username and password with --user=Your_user_name_here --password=Your_password_here

    Documented usage here: http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html

    0 讨论(0)
  • 2021-01-07 00:31

    To backup my DB, I use these three commands (in a batch file):

    mysqladmin -u root -pMyPassword drop backupExample --force=true
    mysqladmin -u root -pMyPassword create backupExample
    mysqldump -h 127.0.0.1 -u root -pMyPassword DBExample | mysql -h 127.0.0.1 -u root -pMyPassword backupExample
    

    where:

    "DBExample" is the name of the DB to backup

    "backupExample" is the new db that will be created as a copy

    "MyPassword" is your db password

    Hope it helps!

    0 讨论(0)
  • 2021-01-07 00:32

    The mysqldump command accesses a program and is not called in the mysql command prompt.

    It basically does a big SELECT * FROM tables... query and echos the output in your terminal, which is why you redirect the output to save it to a file.

    You need to find the direct path to the mysqldump.exe file and then execute it that way.

    C:\...\path\to\mysql\bin\mysqldump.exe -uroot -p DATABASE_SCHEMA > C:\backup.txt

    Only include the -p flag if your mysql root user account has a password and replace the DATABASE_SCHEMA text with what your database name is called.

    0 讨论(0)
  • 2021-01-07 00:34

    Try this mysqldump -uroot -p project > projectbackup.sql.

    Now when prompted for password type "admin"

    0 讨论(0)
  • 2021-01-07 00:34

    Open up a Windows command prompt.

    Click Start -> Run
    Enter “cmd” into the dialog box and click the “OK” button.
    

    Change the directory to the following to access the mysqldump utility.

    cd C:\Program Files\MySQL\MySQL Server 5.5\bin
    

    Create a dump of your current mysql database or table (do not include the bracket symbols [ ] in your commands).

    Run the mysqldump.exe program using the following arguments:

    mysqldump.exe –e –u[username] -p[password] -h[hostname] [database name] > C:\[filename].sql
    
    0 讨论(0)
提交回复
热议问题