patternsqlMinor
MySQL 5.6 OS X 10.8: how tell if my.cnf read?
Viewed 0 times
readcnftellmysqlhow
Problem
With
showing the value of
I think
I'm using the installation by running
mysqld running, I expect to see that /etc/my.cnf has been used by at least one of the commandsps aux | grep mysql | grep -v grep
mysqladmin variables | grep defaults-fileshowing the value of
--defaults-file. But I see no such item. Why not?I think
/etc/my.cnf is being read, since if I put an erroneous entry in its [mysqld] section, e.g., error = true then when I try to start mysqld it aborts with an ERROR message.I'm using the installation by running
mysql-5.6.10-osx10.7-x86_64.pkg from mysql-5.6.10-osx10.7-x86_64.dmg.Solution
Whenever mysqld is launched, it has four default locations it attempts to locate and read
If you run the following:
You will see this:
Note the line that says:
These are the four files read (if they exist).
The above displays come from a Linux Box. So, please run
and see what locations are echoed.
UPDATE 2013-03-17 22:35 EDT
The reason you cannot see the
Please note the following:
Running
my.cnfIf you run the following:
mysqld --help --verbose | head -20 > junk.txt
cat junk.txtYou will see this:
mysqld Ver 5.6.10 for Linux on x86_64 (MySQL Community Server (GPL))
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Starts the MySQL database server.
Usage: mysqld [OPTIONS]
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: mysqld server mysqld-5.6
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,
except for login file.
--defaults-file=# Only read default options from the given file #.Note the line that says:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnfThese are the four files read (if they exist).
The above displays come from a Linux Box. So, please run
mysqld --help --verbose | head -20 > junk.txt
cat junk.txtand see what locations are echoed.
UPDATE 2013-03-17 22:35 EDT
The reason you cannot see the
--defaults-file option is not visible is simple: Since one or more of the default my.cnf files are present, mysqld_safe does not show it on the command line.Please note the following:
mysqlduses the four defaults
- You cannot set
--defaults-filefor mysqld. That's the job ofmysqld_safe
mysqld_safeneeds it explicitly specified in order for it to be visible in the OS
Running
SHOW GLOBAL VARIABLES; will not show any defaults filemysql> show global variables like '%def%';
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
| default_week_format | 0 |
| table_definition_cache | 400 |
+------------------------+--------+
3 rows in set (0.00 sec)
mysql>Code Snippets
mysqld --help --verbose | head -20 > junk.txt
cat junk.txtmysqld Ver 5.6.10 for Linux on x86_64 (MySQL Community Server (GPL))
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Starts the MySQL database server.
Usage: mysqld [OPTIONS]
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: mysqld server mysqld-5.6
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,
except for login file.
--defaults-file=# Only read default options from the given file #./etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnfmysqld --help --verbose | head -20 > junk.txt
cat junk.txtmysql> show global variables like '%def%';
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
| default_week_format | 0 |
| table_definition_cache | 400 |
+------------------------+--------+
3 rows in set (0.00 sec)
mysql>Context
StackExchange Database Administrators Q#36889, answer score: 2
Revisions (0)
No revisions yet.