dam
dam

Reputation: 407

Mysql : can't set lower_case_table_names variable

I'm installing new software on a new Ubuntu 16.0.4 machine and installed MySQL with apt-get. The version I get is 5.7.22 but can't get it to accept my settings of the configuration variable lower_case_table_names.

I'm adding lines like:

[mysql]
lower_case_table_names = 1

When I edit any of the *.cnf files in /etc/mysql to have this setting or if I add it to ~/.my.cnf I get

mysql: [ERROR] unknown variable 'lower_case_table_names=1'

if I try to start mysql. Similarly I can't use it on the mysql command line like the doc says I can.

/usr/bin/mysql --lower_case_table_names=1 -u root -p

However:

If I go into the SQL command interpreter and type

mysql> select @@lower_case_table_names;

I get back a result showing the variable is set to 0. However it cannot be changed with a SET statement...

So whats the deal with why I can't set this variable ?

~/.my.cnf file:

[mysqld]
lower_case_table_names = 1
[mysql]
lower_case_table_names = 1

Why is mysql not liking this variable name when clearly it still has a setting for it?

Upvotes: 1

Views: 7179

Answers (1)

dam
dam

Reputation: 407

The problem is that this variable does not apply to mysql. It only applies to mysqld. Stop mysqld, change the my.cnf to have a setting for [mysqld], and then start mysqld. This will set the lower_case_table_names value for the mysql server.

If you run /usr/bin/mysql (a command line mysql shell) it will not want a setting for this var in the config file. The shell will behave as the mysql server behaves.

Upvotes: 4

Related Questions