Centos7下 MySQL 导入大批量sql的处理方法

一、上传SQL文件至服务器

二、pwd SQL文件的目录 复制下这个目录

[root@iZ2zeeq04koeqssc98d0okZ html]# pwd
/usr/local/nginx/html

三、进入mysql 开始导入

[root@iZ2zeeq04koeqssc98d0okZ html]# mysql -uroot -p

mysql> show global variables like 'max_allowed_packet';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    56
Current database: *** NONE ***

+--------------------+---------+
| Variable_name      | Value   |
+--------------------+---------+
| max_allowed_packet | 4194304 |
+--------------------+---------+
1 row in set (0.00 sec)

mysql> set global max_allowed_packet=268435456;
Query OK, 0 rows affected (0.00 sec)

mysql> show global variables like 'max_allowed_packet';
+--------------------+-----------+
| Variable_name      | Value     |
+--------------------+-----------+
| max_allowed_packet | 268435456 |
+--------------------+-----------+
1 row in set (0.00 sec)

mysql> create database cnarea20160731
    -> ;
Query OK, 1 row affected (0.00 sec)

mysql> use area;
Database changed

mysql> source /usr/local/nginx/html/area.sql
Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 100594 rows affected (1.56 sec)
Records: 100594  Duplicates: 0  Warnings: 0

Query OK, 97808 rows affected (1.48 sec)
Records: 97808  Duplicates: 0  Warnings: 0

Query OK, 102796 rows affected (1.55 sec)
Records: 102796  Duplicates: 0  Warnings: 0

Query OK, 99586 rows affected (1.55 sec)
Records: 99586  Duplicates: 0  Warnings: 0

Query OK, 102113 rows affected (1.59 sec)
Records: 102113  Duplicates: 0  Warnings: 0

Query OK, 102504 rows affected (1.59 sec)
Records: 102504  Duplicates: 0  Warnings: 0

Query OK, 101451 rows affected (1.58 sec)
Records: 101451  Duplicates: 0  Warnings: 0

Query OK, 45381 rows affected (0.68 sec)
Records: 45381  Duplicates: 0  Warnings: 0





猜你喜欢

转载自blog.csdn.net/jartins/article/details/80525845
今日推荐