Determinar qué archivo de configuración se utiliza
¿Hay un comando para determinar qué archivo de configuración MySQL 5.0 está utilizando actualmente?
13 answers
Si estás en Linux, entonces inicia el 'mysqld' con strace
, por ejemplo strace ./mysqld
.
Entre todas las otras llamadas al sistema, encontrarás algo como:
stat64("/etc/my.cnf", 0xbfa3d7fc) = -1 ENOENT (No such file or directory)
stat64("/etc/mysql/my.cnf", {st_mode=S_IFREG|0644, st_size=4227, ...}) = 0
open("/etc/mysql/my.cnf", O_RDONLY|O_LARGEFILE) = 3
Así que, como puede see..it enumera el .archivos cnf, que intenta utilizar y finalmente utiliza.
Tomado del fantástico libro de O'Reilly" High Performance MySQL":
$ which mysqld
/usr/sbin/mysqld
$ /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
Default options are read from the following files in the given order:
/etc/mysql/my.cnf ~/.my.cnf /usr/etc/my.cnf
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-21 20:34:53
Si ejecuta mysql --verbose --help | less
le dirá sobre la línea 11 qué archivos .cnf
buscará.
También puede hacer mysql --print-defaults
para mostrarle cómo se utilizarán los valores de configuración. Esto también puede ser útil para identificar qué archivo de configuración está cargando.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-02-24 05:57:08
Estoy en Windows y he instalado la versión más reciente de MySQL community 5.6
Lo que hice para ver qué utiliza el archivo de configuración fue ir a Herramientas administrativas > Servicios > MySQL56 > Clic derecho > Propiedades y comprobar la ruta al ejecutable:
"C:/Program Files / MySQL / MySQL Server 5.6 / bin \ mysqld" def defaults-file = "C:\ProgramData\MySQL\MySQL Servidor 5.6 \ my.ini " MySQL56
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-09 17:06:24
Una alternativa es usar
mysqladmin variables
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-10-20 15:22:36
Mysqld help help verb verbose es peligroso. Puede sobrescribir fácilmente pidfile para ejecutar la instancia! úsalo con p pid-file = XYZ
Ah, y realmente no se puede utilizar si tiene más de 1 instancia en ejecución. Solo le mostrará el valor predeterminado.
Muy buen artículo al respecto:
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-04-16 00:39:36
Acabo de hacer una prueba rápida en ubuntu:
-
Instalado mysql-server, que creó/etc / mysql / my.cnf
-
Mysqld {verbose help help | grep-A 1 "Default options"
110112 13:35:26 [Nota] Plugin 'FEDERATED' está desactivado.
Las opciones predeterminadas se leen de los siguientes archivos en el orden dado:
/ etc / my.cnf / etc / mysql / my.cnf / usr / etc / my.cnf ~/. my. cnf
Creado /etc / my.cnf y / usr / etc / my.cnf, cada uno con un puerto diferente número
-
Reiniciado mysql-estaba usando el número de puerto establecido en/usr/etc / my.cnf
También encontró la opción def defaults-file en el mysqld. Si especifica un archivo de configuración allí, solo se utilizará ese, independientemente de lo que devuelva /usr / sbin | mysqld {verbose help help / grep-A 1 "Default options"
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-01-12 13:44:49
Encontré esto muy útil:
- Encuentre el proceso MySQL en Servicios bajo
Control Panel -> Administration Tools
- Haga clic con el botón derecho del ratón y elija
Properties
- Haga clic y seleccione la
Path to executable
y vea si contiene la ruta a lamy.ini/my.cfg
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-10 11:36:20
Algunos servidores tienen varias versiones de MySQL instaladas y configuradas. Asegúrese de que está tratando con la versión correcta que se ejecuta con un Unix comando de:
ps -ax | grep mysql
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-10 11:35:31
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-04 12:56:45
Para las personas que ejecutan windows server con mysql como servicio, una manera fácil de averiguar qué archivo de configuración está ejecutando es abrir el panel de control de servicios, encontrar su servicio mysql (en mi caso 'MYSQL56'), haga clic con el botón derecho y haga clic en propiedades. A continuación, desde aquí se puede comprobar la "Ruta al ejecutable" que debe tener un interruptor defaults-file
que apunta a donde se encuentra su archivo de configuración.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-26 12:28:04
En caso de que esté ejecutando mac esto también se puede lograr mediante:
sudo dtruss mysqld 2>&1 | grep cnf
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-06-22 09:33:49
Si está en Windows, puede usar Sysinternals procmon. Ábrelo y configura la configuración del filtro de esta manera, luego haz clic en "Agregar". Ahora procmon monitoreará mysqld.
Ahora inicie su servidor mysql de forma normal. Procmon capturará las operaciones en segundo plano de mysql. Buscar " mi."en el panel de resultados de procmon y encontrará algo como lo siguiente:
Está claro que mysql busca una lista de archivos de configuración en convertir. En mi caso se encontró C:\mysql-5.7.19-winx64\my.cnf
con éxito por lo que está utilizando este.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-28 08:00:31