MySQL the.cnf vs the-huge.cnf

my.cnfMySQL

I've recently installed MySQL server and client 5.5.28 through rpm packages on an openSUSE machine, and I was not able to locate my.cnf file. I look into all directories mysql --verbose --help | grep -C3 my.cnf printed which was /etc/my.cnf (no such a file), /etc/mysql/my.cnf(no directory as mysql), usr/etc/my.cnf (don't have etc in my usr) and ~/.my.cnf (doesn't exist). Then I tried find / -name *.cnf which gave me:

/usr/share/doc/MySQL-server-standard-5.0.24a/my-huge.cnf
/usr/share/doc/MySQL-server-standard-5.0.24a/my-innodb-heavy-4G.cnf
/usr/share/doc/MySQL-server-standard-5.0.24a/my-large.cnf
/usr/share/doc/MySQL-server-standard-5.0.24a/my-medium.cnf
/usr/share/doc/MySQL-server-standard-5.0.24a/my-small.cnf 
/usr/share/ssl/openssl.cnf
/usr/share/mysql/my-large.cnf
/usr/share/mysql/my-huge.cnf
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-small.cnf 

I want to edit my.cnf file to practice replication and high availability. I read somewhere that having my.cnf file won't be necessary to use MySQL well not in my case… so I was thinking to rename one these my-*.cnf to my.cnf and put it in the locations that MySQL would look for my.cnf file. But I'm not sure first if this would work, and second which one to pick to be able to practice replication.

I don't want to make it complex for myself, so I was thinking to take the medium one… Am I doing the right thing?

Best Answer

If you are doing replication and you are just practicing, the my.cnf you choose is not that important. However, the smaller the config, the better. For example, if you DB Server has 2GB RAM, you should not choose my-innodb-heavy-4G.cnf.

If you started up mysql with a my.cnf, you create the default 10M or 18M ibdata1 and 2 5M InnoDB log files (ib_logfile0, ib_logfile1). The medium cnf has the following InnoDB settings:

[root@******** ~]# cat /usr/share/mysql/my-medium.cnf | grep innodb
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

Since everything related to InnoDB is commented out, you should OK to choose my-medium.cnf

Simply run this:

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
service mysql restart

Now, as for MySQL Replication, I have Good News : I already answered a post back on Feb 06, 2012 ( How to setup replication(Master/slave) in MySQL 5.5.20? ) with all the steps you need to automate a Slave's creation.

Here is a couple more of my posts with more advanced replication setups