这个问题困扰了我两天,,之前批量导入数据的时候报错: Packet for query is too large
然后在网上查了不少文档,和资料。要更改配置文件 my.ini
大家写的都很详细,但我的修改配置文件,重启服务,然而怎么查都没有用。先附上解决的修改的链接:
修改 my.ini 中 max_allowed_packet
https://blog.csdn.net/u011014001/article/details/51178402
但这个链接对我没啥用。。我在命令行试了配置文件改了。mysql都重新装了好几次。但一直没生效。
后来我发现问题在于我不知道这个配置文件中这一句写到哪里。然后就去继续查。得到了这个链接。
修改 my.ini 中 max_allowed_packet详细版
https://blog.csdn.net/fly0744/article/details/13623079
改写在
[mysqld] 这个后面的
然后我试了,还是没啥卵用。。。因为我的配置文件就好像不生效一样。
此时由于数据不多,我决定重新搞起。就把数据库卸载了,至于怎么卸载的。
参考了这个链接。先停止服务->卸载程序->删除注册表->删除文件夹
干净的卸载MySQL
https://blog.csdn.net/qq_34266804/article/details/82822416
此时我们一切从头开始,按部就班安装就好了。我已经装了不下十几遍所以不用链接。
还是贴一个链接:
完美的安装MySQL
https://www.cnblogs.com/xiaxiaoxu/p/8977418.html
当然以上都是小case,这些我试了很多次了。接下来才是重点。
新装的mysql 是没有 my.ini 的配置文件的,只有一个 my-default.ini
然后捏 我就
步骤一:复制一份 my-default.ini 重命名为 my.ini
步骤二:停掉MySQL服务
具体做法:在你的搜索栏搜索 “服务”然后进去找到MySQL 5.7 然后停掉他
步骤三:哎呀下班了不想写了,直接贴个链接看吧。。。虽然也不会有人看。只有我自己看,但我是真饿了。。。
删除服务,重写配置文件,添加服务,完美解决问题
https://www.cnblogs.com/1285026182YUAN/p/10422133.html
ps:但我的my.ini 并没有用它里面的内容,只是在默认的 my.ini里面加了
以下5行
basedir =C:\Program Files\MySQL\MySQL Server 5.7
datadir =C:\Program Files\MySQL\MySQL Server 5.7\data
port =3306
#server_id = …
max_allowed_packet=32M
这个怎么调字体大小和颜色。。。。
下面是我全部的my.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]
# 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 =C:\Program Files\MySQL\MySQL Server 5.7
datadir =C:\Program Files\MySQL\MySQL Server 5.7\data
port =3306
# server_id = .....
max_allowed_packet=32M
# 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
下班了下班了。
本文分享了解决MySQL批量导入数据时遇到的Packetforqueryistoolarge错误的全过程。通过调整my.ini配置文件中的max_allowed_packet参数,并正确定位配置项位置,最终解决了问题。文章还提供了详细的卸载和重新安装MySQL的步骤。

965

被折叠的 条评论
为什么被折叠?



