Easy Linux MySQL default configuration on cloud server

When you initially install MySQL on a cloud server (Ubuntu 14.04) the /etc/mysql/my.cnf file is configured to work with only 32M RAM. This is pretty crazy when you consider that most cloud servers have at least 1GB of RAM, it could be holding your website up so it is something you should consider changing.

If you want a quick way of boosting the MySQL performance without having to tune the configuration, then a number of pre-built configurations are stored in: /usr/share/doc/mysql-server-5.5/examples/

my-huge.cnf is for a system with memory of 1G-2G.

It would be nice if you could just copy this over my.cnf and restart MySQL but that doesn’t work. You’ll get the message start: Job failed to start

What needs changing to make this work on a recently installed system?

Edit the [mysqld] section, add user = mysql and that’s all you need to do if you are using MyISAM.

If you want to use InnoDB then remove the commented out section on Replication Slave (it’s unnecessary and just complicates understanding the file)

Uncomment the InnoDB section but leave the following line commented out:

#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend

because by default it uses: innodb_data_file_path = ibdata1:10M:autoextend which is auto-extending.

Finally before starting MySQL you need to delete the log files with rm /var/lib/mysql/ib_logfile* because these details have changed.
That’s all you need to do. You’ll now be able to enjoy the extra performance of having a MyISAM key buffer of 384MB and an InnoDB buffer pool of 384MB.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.