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
Answered for only MySQL Workbench users,
I don't know how you've setup MySQL on your Linux environment but have you checked?
Found mine using
Another option is to use the whereis command.
E.g. whereis my.cnf
I installed xampp bundle with
apache, php and mysql
in ubuntu. Theremy.cnf
file is located in/opt/lampp/etc/
folder. Hope it'll help somebody.You can actually "request" MySQL for a list of all locations where it searches for my.cnf (or my.ini on Windows). It is not an SQL query though. Rather, execute:
or, prior 5.7:
In the very first lines you will find a message with a list of all my.cnf locations it looks for. On my machine it is:
Or, on Windows:
Note however, that it might be the case that there is no my.cnf file at any of these locations. So, you can create the file on your own - use one of the sample config files provided with MySQL distribution (on Linux - see
/usr/share/mysql/*.cnf
files and use whichever is appropriate for you - copy it to/etc/my.cnf
and then modify as needed).Also, note that there is also a command line option
--defaults-file
which may define custom path to my.cnf or my.ini file. For example, this is the case for MySQL 5.5 on Windows - it points to a my.ini file in the data directory, which is not normally listed withmysqld --help --verbose
. On Windows - see service properties to find out if this is the case for you.Finally, check the https://dev.mysql.com/doc/refman/8.0/en/option-files.html - it is described there in more details.