You can tell a MySQL program to ignore the default options files by telling it to read a specific file at a location given with the defaults-file option. For example, you can write
mysql --defaults-file=path_to_options_fileIf you’d
like to use an options file alongside the default files, you can specify it using the defaults-extra-file option
mysql --defaults-extra-file=path_to_local_options_fileFinally, you can prevent programs from reading in any options files by adding
the no- defaults option mysql --no-defaultsOn a Linux or Mac OS X system,
the search order is /etc/my.cnf, then
/my.cnf, defaults-extra-file
, and finally
/.my.cnf.
Note that for security reasons, files that are world-writable are ignored. A generally appropriate permission setting is for the file owner (user) to be able to read and write the file, but for the group and others to be able to only read the file. You can set this level of access by opening a terminal window and typing
chmod u=rw,g=r,o=r configuration_fileNote that if you’re trying to change the permissions of a file
owned by the system root user, you’ll need to run the chmod command when logged in as the system root user, or prefix the command with the sudo keyword.
On a Windows system, clients try to access options
files in this order first
dows_Directory>\my.ini, then \my.cnf, C:\my.ini, C:\my.cnf,
\my.ini, \my.cnf and then defaults-extra- file. Again, under Windows, the server doesn’t read in the options file automatically,
and you need to tell it to do sousing the defaults-file option.
Share with your friends: