简体   繁体   中英

How I INSERT to MySQL data about 10000 lines using php

I am inserting data from a csv file to mysql datebase using PHP but I can't INSERT more then 922 lines . Every time the number of the lines is different, usually it is 841 or 837 but after restart my mysql-server PC it has the maximum number - 922 rows. I am runing Ubuntu server 16.04

vi /var/log/mysql/error.log is :

0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 223238094ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)

The innodb_page_cleaners default value was changed from 1 to 4 in MySQL 5.7.8. If the number of page cleaner threads exceeds the number of buffer pool instances, innodb_page_cleaners is automatically set to the same value as innodb_buffer_pool_instances.

Check innodb_buffer_pool_instances with: mysql> SHOW GLOBAL VARIABLES LIKE innodb_buffer_pool_instances:

You can only set innodb_page_cleaners as high as innodb_buffer_pool_instances. If you want innodb_page_cleaners=4 then you also need innodb_buffer_pool_instances=4.

You can try MySQL - LOAD DATA... in PHP with mysql_query function.

LOAD DATA LOCAL INFILE 'file_name_with_full_path'
            INTO TABLE table_name
            FIELDS TERMINATED BY ',' 
            OPTIONALLY ENCLOSED BY '"' 
            LINES TERMINATED BY '\n'
            (TABLE_FIELDS)

For more details - http://dev.mysql.com/doc/refman/5.7/en/load-data.html

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM