您的位置:首页 > 数据库 > MySQL

mysql 备份和恢复数据库

2013-05-10 22:50 645 查看
http://blog.winhost.com/using-mysqldump-to-backup-and-restore-your-mysql-databasetables/

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


[title3]
Use the mysqldump utility to create a backup of you database.[/title3]

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

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:





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

Open up a windows command prompt.

Click Start -> Run

Enter “cmd” into the dialog box and click the “OK” button.

Go to the directory that the mysql client utility is located.

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

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





内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: