Skip to content

Instantly share code, notes, and snippets.

@jansanchez
Last active June 10, 2021 06:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jansanchez/7893091 to your computer and use it in GitHub Desktop.
Save jansanchez/7893091 to your computer and use it in GitHub Desktop.
MySQL lower case table names sensitive in linux

MySQL lower case table names sensitive in linux

Type in your terminal

sudo vim /etc/mysql/my.cnf

Edit the file adding the entry lower_case_table_names=1 just under the group definition: [mysqld]

lower_case_table_names=1

It will look like

[mysqld]
#
# * Basic Settings
#
lower_case_table_names=1
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

Restart mysql

sudo service mysql restart

Enjoy!

@mreis1
Copy link

mreis1 commented Jan 15, 2021

Thank for sharing, although this doesn't work with MySQL 8.
https://bugs.mysql.com/bug.php?id=90695

A workaround is suggested here but be careful.
https://stackoverflow.com/questions/53103588/lower-case-table-names-1-on-ubuntu-18-04-doesnt-let-mysql-to-start/53175727#53175727

Best solution so far to initialize MySQL data directory with the lower_case_table_names=1
https://stackoverflow.com/a/63141850/1084568

@SincerelyUnique
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment