1. 程式人生 > >資料庫的匯入以及匯出

資料庫的匯入以及匯出

mysql> source D:/phpStudy/PHPTutorial/WWW/2018-12-1/bbs_user.sql;  

mysql> use bbs_user;
Database changed
mysql> source D:/phpStudy/PHPTutorial/WWW/2018-12-1/bbs_user.sql;
Query OK, 0 rows affected (0.01 sec)
 
mysql> select * from bbs_user;
Empty set (0.00 sec)
 
mysql> insert into bbs_user (username,userpass,teleno,sex,birthdy) values('feiyu
',123,110110110,'man','2018-12-1 21:50');
Query OK, 1 row affected, 1 warning (0.00 sec)
 
mysql> desc bbs_user;
+----------+--------------------+------+-----+------------+----------------+
| Field    | Type               | Null | Key | Default    | Extra          |
+----------+--------------------+------+-----+------------+----------------+
| id       | int(10) unsigned   | NO   | PRI | NULL       | auto_increment |
| username | varchar(50)        | NO   | MUL | NULL       |                |
| userpass | varchar(50)        | NO   | MUL | NULL       |                |
| teleno   | varchar(20)        | NO   | UNI | NULL       |                |
| sex      | enum('man','wman') | NO   |     | man        |                |
| birthdy  | date               | NO   |     | 0000-00-00 |                |
+----------+--------------------+------+-----+------------+----------------+
6 rows in set (0.01 sec)
mysql> insert into bbs_user (username,userpass,teleno,sex,birthdy) values('yuge'
,456,120120120,'man','2018-12-1 22:00');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> insert into bbs_user (username,userpass,teleno,sex,birthdy) values('zheny
u',789,114114114,'man','2018-12-1 22:10');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> select * from bbs_user;
+----+----------+----------+-----------+-----+------------+
| id | username | userpass | teleno    | sex | birthdy    |
+----+----------+----------+-----------+-----+------------+
|  1 | feiyu    | 123      | 110110110 | man | 2018-12-01 |
|  2 | yuge     | 456      | 120120120 | man | 2018-12-01 |
|  3 | zhenyu   | 789      | 114114114 | man | 2018-12-01 |
+----+----------+----------+-----------+-----+------------+
3 rows in set (0.00 sec)
mysql> exit;

 

D:\phpStudy\PHPTutorial\MySQL\bin>mysqldump -h localhost -u root -p bbs_user >D:
\phpStudy\PHPTutorial\WWW\2018-12-1\1_bak.sql
Enter password: ****
 
D:\phpStudy\PHPTutorial\MySQL\bin>

 

 匯出後的資料夾 1_bak.sql

 

匯出後的內容