mysql - 错误 2006 (HY000) 在第 2759 行 : MySQL server has gone away

标签 mysql database memory import

我正在尝试使用 cmd 中的以下命令将 sql 文件导入到我的数据库中:

mysql -u  root -p social-media-db < socialmediaexaminer_dev_2017-07-15T18-41-51_UTC_database.sql

是的,我之前用谷歌搜索过,阅读了所有现有文档为什么会发生这种情况,但没有任何帮助我。上面说

ERROR 2006 (HY000) at line 2759: MySQL server has gone away

我的文件:

my-default.ini

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]
max_allowed_packet=99999999M
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

我尝试导入的文件大小为 1.4GB。

最佳答案

您的设备不太可能在 .ini 中支持此请求 --

max_allowed_packet=99999999M

这大约是 99,999,999,000,000 字节的内存。 99 太字节?

将其减少到 100M 左右,并让我们知道这是否适合您。

关于mysql - 错误 2006 (HY000) 在第 2759 行 : MySQL server has gone away,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45132007/

相关文章:

php - MySQLi 数据库文件

javascript - 如何将数据存储在database.db中而不丢失数据?

php - Bootstrap 模态背景不覆盖按钮和字段

c - (C) 使用数组进行动态内存分配

memory - CPU乱序执行和内存顺序有什么关系?

php - Webapp - 限制用户使用的最佳方法

Java返回空列表而不是对象

MySQL 插入查询,其中值不匹配

Java:本身的类和内存使用情况(例如:简单的二叉树实现)?

php - 为什么 PHP 转换 MySQL BIT(1) 值 b'0' to boolean ' true'