I am experimenting with option files in MySQL. I have a ~/.my.cnf
file which includes only the following:
!include /Users/myself/Workspace/project_time/mysql/foo.cnf
[client]
i_am_a_dummy
And I have a file /Users/myself/Workspace/project_time/mysql/foo.cnf
which includes only the following:
[mysqld]
skip_column_names
I have newlines at the end of each file.
I also have a database, new_database
, which includes a table t1
.
I run MySQL with the command mysql -uroot -p new_database;
and type in my password at the prompt, after which I see the MySQL prompt. When I type select * from t1;
at the prompt, I would expect to see the output without headers, like so:
mysql> select * from t1;
+------+------+------+
| 2001 | 1 | 1 |
| 2001 | 1 | 20 |
| 2001 | 1 | 30 |
| 2001 | 2 | 2 |
| 2001 | 2 | 23 |
| 2001 | 2 | 23 |
+------+------+------+
6 rows in set (0.00 sec)
Unfortunately, instead I see the following:
mysql> select * from t1;
+------+-------+------+
| year | month | day |
+------+-------+------+
| 2001 | 1 | 1 |
| 2001 | 1 | 20 |
| 2001 | 1 | 30 |
| 2001 | 2 | 2 |
| 2001 | 2 | 23 |
| 2001 | 2 | 23 |
+------+-------+------+
6 rows in set (0.00 sec)
I have already tried to use [client]
as the option group in foo.cnf
instead of [mysqld]
, but that did not work.
When I add skip_column_names
directly to ~/.my.cnf
(just below i_am_a_dummy
), it works as expected.
What am I missing?
[mysqld]
. Settings for the commandlinemysql
need to be under[mysql]
or[client]
. (Put them under both.)