I've managed to locate my install directory for MySQL: /usr/local/mysql/
Where can I find the path to my.cnf
to know where I should configure the server? I've tried creating a /etc/my.cnf
(as shown below) and it had no affect
[mysqld]
#charset
collation_server=utf8_general_ci
character_set_server=utf8
default_character_set=utf8
As per this article:
Running this command from the command line / terminal will show where MySQL will look for the my.cnf file on Linux/BSD/OS X systems:
This will output something like this:
You can now check for files using the above output at
/etc/my.cnf
, then/etc/mysql/my.cnf
and so on. If there isn't one at one of those locations, you can create one and know MySQL will use it.On a Linux system 'locate my.cnf" will be the fastest solution.
If there are several my.cnf files, all looking likely (e.g. in
/etc
,/etc/mysql
,/opt/mysql/etc
, etc.), then you can runstrace
to see where MySQL binary tries to find its configuration file, but I do think that's an overkill.It seems like the file your cnf created is being superseded by another one. Check out hte default order below.
From
Default options are read from the following files in the given order: /etc/my.cnf ~/.my.cnf /etc/my.cnf
OK a wild shot in the dark:
If the database is installed in
/usr/local/mysql
, then try looking in/etc/local
formy.cnf
Here is how you can tell if you have a
my.cnf
Run this query
(<= 5.6.7)
OR
(>= 5.6.8)
it moved to the performance schema.If you should get:
(>= 5.6.8)
50331648(<= 5.6.7)
5242880You are running with defaults and there is a possibility that there may not be a
my.cnf
present.NOTE:
How did you install MySQL and on what platform?
Brute force method on an unixoid OS:
strace -fe open /etc/init.d/mysql start 2>&1|grep my.cnf
should show you the system call used to open the file.How are you sure that your cnf file is not being read?
Have you restarted mysqld since the change?
Have you tried to create a new db and looked at its values?
To install locate and updatedb to be able to run it..
Using fedora, centos run as root:
if you are running Ubuntu run:
After you finish the install run updatedb Fedora (as root):
Ubuntu:
then you can run the locate command as listed above. Again the my.cnf is typically located in /etc. Are you sure mysql is installed? if not do the commands above to install it and replace mlocate with mysqld best of luck!