Databases Reference
In-Depth Information
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_file
If 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_file
Finally, you can prevent programs from reading in any options files by adding the no-
defaults option:
$ mysql --no-defaults
On a Linux or Mac OS X system, the search order is /etc/my.cnf , then
<MySQL_Directory>/my.cnf , defaults-extra-file , and finally ~/.my.cnf . Note that for
security reasons, files that are world-writable are ignored. A generally appropriate per-
mission 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_file
Note 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 <Win
dows_Directory>\my.ini , then <Windows_Directory>\my.cnf , C:\my.ini , C:\my.cnf ,
<MySQL_directory>\my.ini , <MySQL_directory>\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 so using the defaults-file option.
Determining the Options in Effect
It can sometimes be unclear which options are in effect for a given program, particularly
if you've got several options files with overlapping directives. You can use the print-
defaults option to most MySQL programs to see the options in effect. For example, to
see the active options for mysqldump , you can type:
$ mysqldump --print-defaults
mysqldump would have been started with the following arguments:
--socket=/home/mysql/server1.sock
--all-databases
--result_file=/tmp/dump.sql
--host=localhost
--port=3306
--database=Music
--result_file=/home/saied/dump.sql
 
Search WWH ::




Custom Search