mysql 备份和恢复数据库

来源:互联网 发布:开发票软件操作流程 编辑:程序博客网 时间:2024/05/01 06:27

http://blog.winhost.com/using-mysqldump-to-backup-and-restore-your-mysql-databasetables/

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


Use the mysqldump utility to create a backup of you database.

  1. Open up a Windows command prompt.
    • Click Start -> Run
    • Enter “cmd” into the dialog box and click the “OK” button.
  2. Change the directory to the following to access the mysqldump utility.
    • cd C:\Program Files\MySQL\MySQL Server 5.5\bin
  3. 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
  4. If you supplied all the arguments properly, the program will connect to your current mysql server and create a dump of your whole database in the directory you specified in your C:\ directory. There is no message that will indicate the dump has been completed, the text cursor will simply move to the next line.

Here is an example of the command line syntax:


Use the mysql utility to restore your database/table(s) dump to your WinHost MySQL database

  1. Open up a windows command prompt.
    • Click Start -> Run
    • Enter “cmd” into the dialog box and click the “OK” button.
  2. Go to the directory that the mysql client utility is located.
    • cd C:\Program Files\MySQL\MySQL Server 5.5\bin
  3. Import the dump of your database or table.
    • Run the mysql.exe program using the following arguments.
    • mysql –u[user name] -p[password] -h[hostname] [database name] < C:\[filename].sql



原创粉丝点击