Mysql
 SQL >> Database >  >> RDS >> Mysql

MySQL su Homebrew: dove si trova il file my.cnf?

Di default my.cnf non esiste: MySQL parte quindi con tutte le impostazioni predefinite. Se vuoi crearne uno per sovrascrivere i valori di default, posizionalo in /etc/my.cnf.

Puoi anche eseguire mysql --help e cercare l'elenco dei percorsi di configurazione:

Default options are read from the following files in the given order:
/etc/my.cnf
/etc/mysql/my.cnf
/usr/etc/my.cnf
~/.my.cnf

The following groups are read: mysql client

The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file.
--defaults-file=#       Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.

Come si vede, esistono anche opzioni per ignorare i file di configurazione o per specificarne altri da leggere quando invochi mysql da riga di comando.

Nota sui percorsi Homebrew

Con un'installazione Homebrew il file si trova tipicamente in /usr/local/etc/my.cnf (o /opt/homebrew/etc/my.cnf su Apple Silicon): è utile verificarlo con mysql --help prima di crearlo a mano.