mysql表的备份还原操作教程
使用dump命令备份:
mysql dump -u username -p tb_name >outfile
password:****
eg:
c:\users\administrator>mysqldump -uroot -p example0 pp>e:\pp.sql
enter password: ****
打开两个cmd窗口可以方便查看
mysql> use example0//
database changed
mysql> show tables//
+--------------------+
| tables_in_example0 |
+--------------------+
| course |
| k |
| n |
| po |
| pp |
| qq |
| sc |
| show_av |
| student |
| teacher |
| user_cost |
+--------------------+
11 rows in set (0.00 sec)
mysql> drop table pp//
query ok, 0 rows affected (0.06 sec)
mysql> show tables//(删除表,以便之后表的还原操作)
+--------------------+
| tables_in_example0 |
+--------------------+
| course |
| k |
| n |
| po |
| qq |
| sc |
| show_av |
| student |
| teacher |
| user_cost |
+--------------------+
10 rows in set (0.00 sec)
还原:
mysql -u root -p tb_name
password:****
eg:
c:\users\administrator>mysql -u root -p example0
enter password: ****
mysql> show tables//
+--------------------+
| tables_in_example0 |
+--------------------+
| course |
| k |
| n |
| po |
| pp |
| qq |
| sc |
| show_av |
| student |
| teacher |
| user_cost |
+--------------------+
11 rows in set (0.00 sec)