# Can't find my.cnf



## yagokurt (Mar 30, 2015)

Hi everybody today I'm facing a strange problem. Today iI wanted to change my MariaDB to slow query log, and when I try locate the my.cnf I just notice I haven't it on my server, I try use `find / -name my.cnf` and it don't find anything. Any suggestion or idea of what I could do about this?


----------



## scottro (Mar 30, 2015)

What does `ps -aux|grep mysql` show you.  It should show among other things, the location of my.cnf. 

If you never did anything with it, it should be in /var/db/mysql/my.cnf


----------



## SirDice (Mar 30, 2015)

scottro said:


> If you never did anything with it, it should be in /var/db/mysql/my.cnf


The file isn't installed by default. By default MySQL (and I presume MariaDB too) will take sane defaults without the need for a my.cnf.


----------



## gkontos (Mar 30, 2015)

You can find some examples in /usr/local/share/mysql. But IMHO they are not realistic for todays hardware. I keep mine in /usr/local/etc/my.cnf.


----------



## yagokurt (Mar 30, 2015)

scottro said:


> What does `ps -aux|grep mysql` show you.  It should show among other things, the location of my.cnf.
> 
> If you never did anything with it, it should be in /var/db/mysql/my.cnf



This is my output when I did the `ps -aux|grep mysql`
And I never did anything with the my.cnf



SirDice said:


> The file isn't installed by default. By default MySQL (and I presume MariaDB too) will take sane defaults without the need for a my.cnf.



SirDice, do you recommend me to take this file from other server and put on mine?



gkontos said:


> You can find some examples in /usr/local/share/mysql. But IMHO they are not realistic for todays hardware. I keep mine in /usr/local/etc/my.cnf.



I didn't understand very well what you mean gkontos. And if it help in anyway my hardware is a Intel(R) Xeon(R) CPU E3-1245 V2 @ 3.40GHz with 32GB RAM.


----------



## gkontos (Mar 30, 2015)

yagokurt said:


> I didn't understand very well what you mean gkontos. And if it help in anyway my hardware is a Intel(R) Xeon(R) CPU E3-1245 V2 @ 3.40GHz with 32GB RAM.



Well, my point is that usually those examples are way too old for modern hardware. So, if this is a dedicated database server you might want to change some values. I have used percona online tools in the past with good success. In any case, the location that you want to place my.cnf is /usr/local/etc/.


----------



## yagokurt (Mar 30, 2015)

gkontos said:


> Well, my point is that usually those examples are way too old for modern hardware. So, if this is a dedicated database server you might want to change some values. I have used percona online tools in the past with good success. In any case, the location that you want to place my.cnf is /usr/local/etc/.



Okay, I'm going to take a look at this percona, I'm using tables in MyISAM, will it affect in anyway? And about the /usr/local/share/mysql I took the my-large.cnf and make this change what you think about?

```
query_cache_type = 1
query_cache_limit = 2M
query_cache_strip_comments = 1
query_cache_size = 16M
slow_query_log = ON
slow_query_log_file = "/var/log/slow_query.log"
```


----------



## Beeblebrox (Mar 30, 2015)

From UPDATING:


> 20140521:
> AFFECTS: users of databases/mariadb55*
> AUTHOR: grembo@FreeBSD.org
> 
> ...


----------



## yagokurt (Mar 30, 2015)

Beeblebrox said:


> From UPDATING:



I put the file on /var/db/mysql/my.cnf like they said on the start and its reading the configuration perfect on my test server. I'm using databases/mariadb100-server. I will can test on the main server only tomorrow morning.


----------



## gkontos (Mar 30, 2015)

yagokurt said:


> Okay, I'm going to take a look at this percona, it work even with MyISAM? And about the /usr/local/share/mysql I took the my-large.cnf and make this change what you think about?



Percona is focused mainly on InnoDB. That does not mean that you can not still use their analyzing tools. I am sorry but for MyISAM I would only give poor advices. Maybe someone else could help better.


----------



## scottro (Mar 30, 2015)

SirDice said:


> The file isn't installed by default. By default MySQL (and I presume MariaDB too) will take sane defaults without the need for a my.cnf.



By golly, you're right.  To the OP, sorry for the misinformation, it's a my-default.cnf that's installed by default.   Thanks.


----------



## yagokurt (Mar 30, 2015)

gkontos said:


> Percona is focused mainly on InnoDB. That does not mean that you can not still use their analyzing tools. I am sorry but for MyISAM I would only give poor advices. Maybe someone else could help better.



Reading on Percona they said MyISAM is only recommended to experts then do you think a good idea I convert my tables to InnoDB? And about the Percona config they give me this one LINK. Should I change something? Or its already good.


----------



## SirDice (Mar 31, 2015)

MyISAM and InnoDB have different 'characteristics', each engine has it's own uses and you should use the one that fits your requirements the best. If you have lots of reads but hardly any writes MyISAM would be a little better. However, the drawback of MyISAM is that a write to a table will lock the entire table until the write is done. So if you have a lot of read _and_ write access InnoDB would be better suited as it only locks tables partially (leaving the rest available) when writing. 

There are some other considerations with InnoDB though, you really need to turn off the filesystem cache because InnoDB uses its own caching. You also need to account for any inconsistencies and cleanup. All InnoDB databases end up in one big file. It's therefor advisable to use File-per-table. 

That said, you can easily convert a table from one engine to another. So start off with the default engine and see how things work out for you.


----------



## yagokurt (Apr 1, 2015)

I spoke with a couple of people who is using the same system than me and they said they convert from MyISAM to InnoDB and is working well, then I'm going to do the same. At the moment thank you all who helped me.


----------

