Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On my Ubuntu machine, I have installed MySQL .

I notice that there are /etc/my.cnf file which contain the content (only two lines):

innodb_buffer_pool_size = 1G
max_allowed_packet = 512M

While there is also /etc/mysql/my.cnf with a long content like:

# The MySQL database server configuration file.
...
...

For me, it looks like both are configurations for MySQL server, but Why there are two my.cnf in different locations, can't the content to be merged to one my.cnf ? What is the purpose to have seperate my.cnf for MySQL server ?

share|improve this question
    
And you (or someone else) has not created that /etc/my.cnf by hand? Perhaps some program added that? By default it should not be there, unless Ubuntu folk has done something weird; in Debian that file is not present. –  Janne Pikkarainen Dec 1 '11 at 9:49
    
Agreed, there should only be 1 my.cnf. there is only 1 that is being used anyway. –  Flash Dec 1 '11 at 9:52
    
This is my personal working machine, only me touch this machine, and I have never created /etc/my.cnf , until today I notice it is there... –  Mellon Dec 1 '11 at 10:06
    
ls -l /etc/my.cnf to see the modification time? Are you sure it is created after installing MySQL? –  quanta Dec 1 '11 at 10:09

1 Answer 1

The Ubuntu MySQL packages create the configuration file in /etc/mysql/my.cnf, so if you have a /etc/my.cnf file, it is because either a package (probably from multiverse) or a tool you've used, created it.

If you're unsure where the file came from, you can see if it came from a package by using dpkg --search file.name , example output below

root@lamp01:~# dpkg --search my.cnf
mysql-common: /etc/mysql/my.cnf

Ultimately, neither of those config options are particularly dangerous, so you'd be safe to merge them into /etc/mysql/my.cnf and restart MySQL. Though you want to keep an eye on innodb_buffer_pool_size = 1G because if your MySQL service gets busy and you don't have a lot of RAM, your system could get low on memory.

If you're looking to fine tune MySQL, I suggest downloading and running https://github.com/rackerhacker/MySQLTuner-perl

You'll want to make sure that you let your MySQL service run under normal load for 24-48 hours before running mysqltuner though, as it works best when it can analyze MySQL's various performance characteristics under normal/usual load.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.