please tell me is there any mysql command to determine the my.cnf configuration file location just like phpinfo() to determine php.ini file.
Thank you.
please tell me is there any mysql command to determine the my.cnf configuration file location just like phpinfo() to determine php.ini file.
Thank you.
I don't know how you've setup MySQL on your Linux environment but have you checked?
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.)
This might work:
strace mysql ";" 2>&1 | grep cnf
on my machine this outputs:
stat64("/etc/my.cnf", 0xbf9faafc) = -1 ENOENT (No such file or directory)
stat64("/etc/mysql/my.cnf", {st_mode=S_IFREG|0644, st_size=4271, ...}) = 0
open("/etc/mysql/my.cnf", O_RDONLY|O_LARGEFILE) = 3
read(3, "# /etc/mysql/my.cnf: The global "..., 4096) = 4096
stat64("/home/xxxxx/.my.cnf", 0xbf9faafc) = -1 ENOENT (No such file or directory)
So it looks like /etc/mysql/my.cnf is the one since it stat64() and read() were successful.