+--------------------+
| Database |
+--------------------+
| information_schema |
| ar |
| mysql |
| test |
| zhaoyun |
+--------------------+
5 rows in set (0.00 sec)
Database changed
mysql> show tables ;
+----------------+
| Tables_in_ar |
+----------------+
| actionlog |
| admin |
| blog |
+----------------+
3 rows in set (0.00 sec)
[root@zhaoyun ~]# mkdir mysqlback
#备份ar数据库,将ar数据库备份并将备份的sql保存在ar.sql文件
[root@zhaoyun ~]# mysqldump -uroot -p123456 ar > mysqlback/ar.sql
#备份所有数据库
[root@zhaoyun ~]# mysqldump -uroot -p123456 --all-database > mysqlback/all.sql
#备份ar数据库的admin和blog俩张表
[root@zhaoyun ~]# mysqldump -uroot -p123456 ar admin blog > mysqlback/ar-admin-blog.sql
#备份ar和mysql俩个数据库
[root@zhaoyun ~]# mysqldump -uroot -p123456 -B ar mysql > mysqlback/ardb-mysqldb.sql
+--------------------+
| Database |
+--------------------+
| information_schema |
| ar |
| mysql |
| test |
| zhaoyun |
+--------------------+
5 rows in set (0.00 sec)
Query OK, 13 rows affected (0.13 sec)
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
| zhaoyun |
+--------------------+
4 rows in set (0.00 sec)
Query OK, 1 row affected (0.01 sec)
[root@zhaoyun ~]# mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.0.77 Source distribution
+--------------------+
| Database |
+--------------------+
| information_schema |
| ar |
| mysql |
| test |
| zhaoyun |
+--------------------+
5 rows in set (0.00 sec)
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
mysql> show tables ;
+----------------+
| Tables_in_ar |
+----------------+
| actionlog |
| admin |
| blog |
3 rows in set (0.00 sec)
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
mysql> show tables;
+----------------+
| Tables_in_ar |
+----------------+
| actionlog |
| admin |
| blog |
3 rows in set (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
+----------------+
| Tables_in_ar |
+----------------+
| actionlog |
+----------------+
1 rows in set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
+----------------+
| Tables_in_ar |
+----------------+
| actionlog |
| admin |
| blog |
+----------------+
13 rows in set (0.00 sec)
+----+---------------+----------------------------------+------------------+-------------+---------------------+
| id | userName | password | email | telephone | addTime |
+----+---------------+----------------------------------+------------------+-------------+---------------------+
| 1 | Administrator | 21231F2DFA57A5A743894A0E4A801FC3 | admin@system.com | 18392992922 | 2010-08-12 12:23:11 |
+----+---------------+----------------------------------+------------------+-------------+---------------------+