MySQL (5.5)
Jump to navigation
Jump to search
The way things are going, I'm not sure the next DB guide I write for Debian is going to have MySQL in the title. Regardless, this hasn't changed too much over the past few years.
Preparation
- Unless your database server is completely incidental to everything else you are doing, set up hugepages. The performance gain is extremely noticeable, even for tiny sub-gigabyte databases. The exact way to do this may differ with your operating system, so adjust accordingly.
- Some distributions use a group to designate who can access Hugepages, e.g.
- usermod -a -G hugepager mysql
- Debian has its mysqld_safe section in a separate file ( /etc/mysql/conf.d/mysqld_safe_syslog.cnf ) I'm assuming it's gone, here.
- Make sure MySQL is shut down before doing the following tasks:
- If you will be changing the sizes of ib_logfiles, you will need to delete them:
- rm /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile1
- Adjust directory location as needed.
- If, and only if, this is a fresh, virgin installation:
- Delete your ibdata1 file.
- If not, you will want to move it if you are using a multi-disk setup. ibdata1 is where the double-buffer log is written (along with a number of other things that get split in future versions of MySQL), and will represent half of your database writes. Because these are all sequential writes, it's fine to stick this on a platter drive - ideal, even.
- If you are running a master-slave setup, and you are mounting /tmp on tmpfs, you will want to make your own temp directory for MySQL specifically, lest a power failure result in data corruption:
mkdir /mytmp chown mysql:mysql /mytmp chmod 0750 /mytmp