在mysql

时间:2016-07-27 15:24:44

标签: mysql import mysqlimport

我正在使用这个bash脚本在mysql中导入:

ddl="set names utf8; "
ddl="$ddl set global net_buffer_length=1000000;"
ddl="$ddl set global net_write_timeout=1000000;"
ddl="$ddl set global max_allowed_packet=1000000000; "
ddl="$ddl set global key_buffer_size=1000000000; "
ddl="$ddl set global connect_timeout=100000; "
ddl="$ddl set global wait_timeout=100000; "
ddl="$ddl SET foreign_key_checks = 0; "
ddl="$ddl SET UNIQUE_CHECKS = 0; "
ddl="$ddl SET AUTOCOMMIT = 0; "
ddl="$ddl USE ${database}; "
ddl="$ddl source $reducedfile; "
ddl="$ddl SET foreign_key_checks = 1; "
ddl="$ddl SET UNIQUE_CHECKS = 1; "
ddl="$ddl SET AUTOCOMMIT = 1; "
ddl="$ddl COMMIT ; "

echo "Import started"

time mysql -h 127.0.0.1 -u root -proot -e "$ddl"

我的表包含15列,没有索引(只有主键)和大约350k记录。一个简单的日志表..信息是非常基本的只是整数和日期。

当我尝试导入此表时,我在查询期间收到了着名的消息'与MySQL服务器的连接丢失了。有谁知道我在哪里可以找到mysql中止的错误?只有它重启才会在/var/log/mysql/error.log中有用。

当我将记录数量减少到20时,它的进口就好了。不知道现在在哪里查看问题是什么...表格对于我的配置是大的是现在唯一的结论但是我在导入之前设置了所有参数,这是my.cnf

[mysqld]
max_connections = 1000
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address        = 127.0.0.1
#
# * Fine Tuning
#
key_buffer      = 16M
max_allowed_packet  = 256M
thread_stack        = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit   = 1M
query_cache_size        = 16M  

0 个答案:

没有答案