在mysql命令行下执行sql文件
***********在mysql命令行下执行sql文件*********** C:\Windows\system32>cd E:\MySQL\mysql-5.7.16-winx64\bin //将目录切换到mysql的bin文件所在的目录 C:\Windows\system32>mysql -uroot -p520462 -Dtest<E:\test.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:\test.sql //mysql控制台下执行source E:\test.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:\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)
无语言基础,自学python所做的各种笔记,欢迎大牛指点.