MySQL 8.0 lower_case_table_names=1 on Linux
MySQL 8.0 lower_case_table_names=1 on Linux
Overview
This article explains how to change the lower_case_table_names setting for MySQL 8.0 on Linux/Ubuntu.
Instructions
1. Install MySQL:
sudo apt-get install mysql-server-8.0
2. Clean the /var/lib/mysql directory:
root@lifedev:/var/lib/mysql# rm -Rf *
3. Recreate the /var/lib/mysql directory:
sudo mkdir /var/lib/mysql
sudo chown mysql:mysql /var/lib/mysql
sudo chmod 700 /var/lib/mysql
4. Edit the file: /etc/mysql/mysql.conf.d/mysqld.cnf and add lower_case_table_names=1 to [mysqld] section:
5. Re-initialize MySQL with --lower_case_table_names=1 option:
sudo mysqld --defaults-file /etc/mysql/my.cnf --initialize --lower_case_table_names=1 --user=mysql --console
6. Start MySQL: sudo service mysql start
7. Retrieve the new generated password for MySQL user root:
sudo grep 'temporary password' /var/log/mysql/error.log
8. Update MySQL root password
See how to change MySQL root password here.
8. Verify result: SHOW VARIABLES LIKE 'lower_case_%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
+------------------------+-------+
Enjoy 😏
Data directory initialization:
ReplyDeletehttps://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' fix:
ReplyDeletehttps://stackoverflow.com/questions/71927209/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run