Mysql executes SQL file commands
* ********** Execute an SQL file in the mysql command line ***********
C: \ Windows \ system32> cd E: \ MySQL \ mysql-5.7.16-winx64 \ bin // switch the directory to the directory where the binfile of mysql is located
C: \ Windows \ system32> mysql-uroot-p520462-Dtest
// Mysql-u account-p password-D database name <absolute path of the SQL File
Mysql: [Warning] Using a password on the command line interface can be insecure.
Article dealer price
0001 a 3.45
0001 B 3.99
0002 a 10.99
0003 B 1045.00
0003 c 1.69
0003 d 1.25
0004 d 19.95
Mysql> source E: \ test. SQL // run source E: \ test. SQL on the mysql Console
Database changed
ERROR:
No query specified
+ --------- + -------- + --------- +
| Article | dealer | price |
+ --------- + -------- + --------- +
| 0001 | a | 3.45 |
| 0001 | B | 3.99 |
| 0002 | a | 10.99 |
| 0003 | B | 1045.00 |
| 1, 0003 | c | 1.69 |
| 1, 0003 | d | 1.25 |
| 1, 0004 | d | 19.95 |
+ --------- + -------- + --------- +
7 rows in set (0.00 sec)
Mysql> \. e: \ test. SQL // \. e: \ test. SQL
Database changed
ERROR:
No query specified
+ ------ + ------- + ------ +
| Year | month | day |
+ ------ + ------- + ------ +
| 2000 | 01 | 01 |
| 2000 | 02 | 20 |
| 2000 | 01 | 30 |
| 2000 | 02 | 02 |
| 2000 | 02 | 23 |
| 2000 | 02 | 23 |
+ ------ + ------- + ------ +
6 rows in set (0.00 sec)