MySQL数据库传输BLOB类型数据丢失 解决办法

修改MySQL安装目录下my.ini文件配置:

添加 max_allowed_packet = 16M

# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localsta[email protected] for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]

port=3306

[mysql]

default-character-set=utf8
max_allowed_packet = 16M

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306

#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.5/"

#Path to the database root
datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=100

# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size=0

# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=256

# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=35M
max_allowed_packet = 16M

# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client‘s threads are put in the cache if there aren‘t
# more than thread_cache_size threads from before.  This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn‘t give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size=8

#*** MyISAM Specific options

# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G

# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method.  This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=69M

# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you‘re not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
max_allowed_packet=60M
key_buffer_size=55M

# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K

# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
sort_buffer_size=256K

#*** INNODB Specific options ***

# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb

# Additional memory pool that is used by InnoDB to store metadata
# information.  If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS.  As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=3M

# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1

# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size=2M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system.  Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size=107M

# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=54M

# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency=10
时间: 2024-12-28 09:26:36

MySQL数据库传输BLOB类型数据丢失 解决办法的相关文章

Amazon RDS MySQL数据库还原时 log_bin_trust_function_creators 错误解决办法

使用了Amazon AWS EC2免费云空间,数据库实例采用Amazon RDS.原来在Windows Server上有一个存在大量数据的MySQL数据库.现在需要在Amazon RDS上还原这个MySQL数据库,勾掉Views(因为它会要求SUPER权限,而Master User无此权限,毕竟是托管的RDS),只留下Tables,如下图(使用Navicat): 图1:勾掉Views,因为RDS上的Masteruser无Super权限,无法还原Views对象 但在还原时,仍然出现如下的错误信息:

mysql数据库存储中文数据的解决办法

我在学习django中admin模块的时候,登录进入后台操作页面,输入中文数据,但保存之后全是乱码(全是“????????????”),然后就开始了解决问题之路. 1.首先百度搜索,最主流的方法也是一劳永逸的方法是:修改MySQL的配置文件my.ini.我也是按照这个方法做的,只是搜索出来的方法不详细,或者说不适合MySQL的新版本. 2.在MySQL根目录下寻找my.ini配置文件,然而我装的是MySQL-5.6.30,在根目录下只找到了my-default.ini文件.把my-default

failed to open file mysql,导入mysql数据库打不开的解决办法

使用mysql导入数据库时很不凑巧的出现: Failed to open file 'xxx.sql', error: 2 出现这种情况时什么都不要干,第一在你的mysql中设定编码模式 set names 编码模式: 第二尽量你导入的数据库的名字不要是中文,先把他改为英文名再导入试试.如若不行请试以下方法: 主要的原因在于mysql没权限读取你指定导入盘符的权限. so我们此时应该给mysql 加上读取权限 转载请注明出处:http://blog.csdn.net/zch501157081/a

linux下修改mysql数据库编码后无法启动解决办法

linux下老版本的Mysql修改数据库编码的方法是 修改my.cnf vi /etc/my.cnf 在[client]下添加 default-character-set=utf8 在[mysqld]下添加 default-character-set=utf8 在新的版本中如果这样修改的话,会造成无法启动的错误,结果方法是 在[mysqld]下把default-character-set=utf8换成 重启mysql可以使用 sudo /etc/init.d/mysql restart 注意修改

MySQL数据库ab主从复制出错及解决过程

MySQL数据库ab主从复制出错及解决过程 一.mysql主从服务器报错描述:Slave_IO_Running=NO,Slave_SQL_Running=YES,Last_Errno=0 mysql slave stop ; mysql slave start; mysql show slave status ; 如果Slave_IO_Running=YES ...解决过程 :1 如果:Slave_IO_Running=NO,Slave_SQL_Running=YES,Last_Errno=0m

SQL数据库损坏的原因和解决办法

现在许多工作人员还在普遍使用SQL SEVER,由于种种原因,SQL数据库会出 现不同程度的损坏,非常影响员工的正常工作.数据的丢失还可能会给公司带 来巨大损失.本文额外大家介绍SQL数据库损坏的原因和解决办法. 当附加数据库文件MDF及日志文件LDF时,报“823”错误.故障出现原因: (1)在数据库读写过程中突然死机或者断电. (2)服务器重启,重启后数据库出现“置疑”状态. (3)磁盘I/O错误 在以上可能的三种突发故障下,由于缓冲数据丢失,数据库无法写入正确 的数据,导致数据结构紊乱,重

DATABASE CONNECTION ERROR (1): THE MYSQL ADAPTER 'MYSQLI' IS NOT AVAILABLE.解决办法

网站迁移之后遇到:Database connection error (1): The MySQL adapter 'mysqli' is not available.这个问题,我一开始以为是我配置的参数错了呢!然后回去检查,检查好几遍我的数据库账号和密码都没错,但是为什么就是连接不上数据库呢?? 网上有人说是"可能有你安装wamp或者xamp之后,sqlserver的服务没有启动,你可以到系统服务菜单里看看这个是否自动启动."但是我问过空间商,他们说默认都是开启的,然后他们也检查了数

关于php读mysql数据库时出现乱码的解决方法

关于php读mysql数据库时出现乱码的解决方法 php读mysql时,有以下几个地方涉及到了字符集. 1.建立数据库表时指定数据库表的字符集.例如 create table tablename ( id int not null auto_increment, title varchar(20) not null, primary key ('id') )DEFAULT CHARSET =UTF8; 复制代码 2. mysql的字符集 mysql中有三个重要的变量,character_set_

您配置文件中的设置 (空密码的 root) 与 MySQL 默认管理员账户对应...的解决办法

您配置文件中的设置 (空密码的 root) 与 MySQL 默认管理员账户对应.……解决办法很简单:1.修改[email protected]权限的密码. 打开wamp的phpmyadmin,进入它的管理界面,点击权限,这时页面上会显示一张用户权限表,找到用户为: root.主机为:localhost的数据行,点击后面的修改按钮,弹出详细的权限配置页面,找到里面的修改密码项, 两次输入你想修改的密码后,点击执行就完成了数据库中[email protected]权限的密码修改.2.修改phpmya