MySQL导入SQL文件,批量导入SQL语句


问题描述

有个十几M的sql文件,现在需要导入到mysql中, 如何快递导入

解决方案

命令行进入mysql中,使用source命令即可.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| mytest_db          |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
7 rows in set (0.006 sec)

MariaDB [(none)]> use mytest_db;
Database changed
MariaDB [mytest_db]> set names 'utf8';
Query OK, 0 rows affected (0.002 sec)

MariaDB [mytest_db]> source /path/to/sql/run.sql
...
Query OK, 1 row affected (0.000 sec)

MariaDB [mytest_db]> exit
Bye

参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录