I found the documentation for MySQL a little rough around the edges recently when I needed to change a configuration setting for it – everything seemed spread around their comprehensive PDF documentation and it took me a little while to fathom my way through it.

It’s not often that changes to MySQL configuration need to be made. This post is, therefore, more a reminder to myself than anything else.

First locate the configuration file. On my Mac I found this empty configuration file had been created as part of the installation process:

/etc/my.cnf

You’ll need super-user privileges to update it. I used:

sudo vi /etc/my.cnf

Enter the configuration settings you require. I wanted to update the maximum packet size so I entered:

[mysqld]
max_allowed_packet=16000000

Then you should be able to stop MySql with:

mysqladmin -u root -p shutdown

Restart it using whatever start script you prefer. To make sure that your changes have taken effect you can print the server variables to the console with:

mysqladmin -u root -p variables