Today's question about MySQL's max_allowed_packet

Source: Internet
Author: User

Today, the OPS group's classmates came to me, said the backup pool file description is not displayed, and it is not displayed from the beginning of 20th, the previous file description can be displayed, and 20th of their uploaded backup data is indeed transmitted. However, the Web interface file description is not displayed.

First of all, the meaning of the file description: is the company's use of a client at the same time, the data they think are important to upload (rsync) way, and then on the central control machine for each file generated a MD5 value, and finally saved to a field in the database (MD5), the final display of the Web interface , which shows this:

But this project is very long, not using any PHP framework, all the code is functional programming, if a file is viewed in a file, it will be dead people.

As a result, another old colleague from the project group discussed the issue, and the results of the final analysis were:

(1). It is possible to upload this MD5 file on each node to the central control machine without uploading it, resulting in the final MD5 file not being obtained.

(2). find files in all files that contain MD5 and insert update, one file for one file, and finally a SQL for a file:

Update Set = Load_file ('". $target." ' where = ". $id

The SQL statement above is changing the MD5 file descriptor, and it is clear that the MD5 file after number 20th is not read.

Then why didn't you read it?

The previous program or something has not changed, it can only check load_file () the use of the MySQL function

Here is the official usage of Load_file ():

Reads thefile  and returnsThefileContents asA string. to  UseThisfunction, thefileMust be located onThe server host, you must specify the FullPath name toThefile, andYou must has theFILEPrivilege. ThefileMust be readable by  All  andIts size is less than max_allowed_packet bytes.IfThe SECURE_FILE_PRIV system variable is Set  toA nonempty directory name, thefile  toBe loaded must be locatedinchThat directory.IfThefileDoes notExistorCannot beReadBecause one ofThe preceding conditions is  notSatisfied, thefunction returns NULL

The main idea is that the uploaded file needs to be readable, and the size of the file must be less than the Max_allowed_packet value of MySQL server.

Finally, the problem is found, it may be max_allowed_packet this value is too small, it needs to be changed to large.

So, on the terminal to MySQL:

To set:

1  like "%max_allowed%2set=2*1024x768*  1024x768*

Note: Must be exited before it takes effect.

Today's question about MySQL's max_allowed_packet

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.