Is there a MySQL command to locate the my.cnf
configuration file, similar to how PHP's phpinfo()
locates its php.ini
?
相关问题
- Is shmid returned by shmget() unique across proces
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- how to get running process information in java?
- MySQL: conduct a basic search
For Ubuntu 16: /etc/mysql/mysql.conf.d/mysqld.cnf
All great suggestions, in my case I didn't find it in any of those locations, but in
/usr/share/mysql
, I have a RHEL VM and I installedmysql5.5
There is no internal MySQL command to trace this, it's a little too abstract. The file might be in 5 (or more?) locations, and they would all be valid because they load cascading.
Those are the default locations MySQL looks at. If it finds more than one, it will load each of them & values override each other (in the listed order, I think). Also, the
--defaults-file
parameter can override the whole thing, so... basically, it's a huge pain in the butt.But thanks to it being so confusing, there's a good chance it's just in /etc/my.cnf.
(if you just want to see the values:
SHOW VARIABLES
, but you'll need the permissions to do so.)As noted by konyak you can get the list of places mysql will look for your
my.cnf
file by runningmysqladmin --help
. Since this is pretty verbose you can get to the part you care about quickly with:This will give you output similar to:
Depending on how you installed mysql it is possible that none of these files are present yet. You can
cat
them in order to see how your config is being built and create your ownmy.cnf
if needed at your preferred location.You can use :
This might work:
on my machine this outputs:
So it looks like /etc/mysql/my.cnf is the one since it stat64() and read() were successful.