在mysql命令行下执行sql文件

***********在mysql命令行下执行sql文件***********
C:Windowssystem32>cd E:MySQLmysql-5.7.16-winx64in    //将目录切换到mysql的bin文件所在的目录

C:Windowssystem32>mysql -uroot -p520462 -Dtest<E:	est.sql
//mysql -u账号 -p密码 -D数据库名 < sql文件绝对路径

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:	est.sql    //mysql控制台下执行source E:	est.sql
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 |
|    0003 | c      |    1.69 |
|    0003 | d      |    1.25 |
|    0004 | d      |   19.95 |
+---------+--------+---------+
7 rows in set (0.00 sec)

mysql> . e:	est.sql             // . e:	est.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)
原文地址:https://www.cnblogs.com/eason-d/p/9301093.html