Ninja’s Tip of the Day – Larger Uploads to MySQL

MySQL is one of the bread-and-butter applications of the internet world, and one of the FLOSS worlds most dramatic successes. If you are using a MySQL database to store binary data however, you may run into a problem with the paltry 1MB packet size limitation imposed by default in MySQL. If you want to insert larger binary files into your database through an INSERT command, the process is simple.

First you need to find your my.cnf file. In Fedora this is in /etc/my.cnf, and in Ubuntu it is in /etc/mysql/my.cnf. Run a find for it if you can’t find it on your distribution. Edit this file as root, and under the [mysqld] option, just change the: max_allowed_packet option from 1M to whatever you like! If the option isn’t there, just add it.


About this entry