mysql 执行SQL文件

<pre name="code" class="sql">[mysql@master data]$ mysql -urooot -p123456 -Dtest<test.sql
-D 表示数据库的名字
Warning: Using a password on the command line interface can be insecure.
[mysql@master data]$ mysql -urooot -p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 24475
Server version: 5.6.16-log Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| students       |
| t1             |
| t2             |
+----------------+
3 rows in set (0.00 sec)



                                    
原文地址:https://www.cnblogs.com/hzcya1995/p/13351758.html