lower_case_table_names=1 on Ubuntu 18.04 doesn't let mysql to start

∥☆過路亽.° 提交于 2019-12-03 17:13:08

In order to make this work in MySQL 8.0 and linux follow the steps bellow

0) Backup mysql schema before executing the following steps using

mysqldump  -h localhost -u root -p mysql > /home/username/dumps/mysqldump.sql

and then stop mysql using

sudo service mysql stop

1) move or remove /var/lib/mysql directory. This will delete all databases!!!!

mv /var/lib/mysql /tmp/mysql

2)Create a new /var/lib/mysql directory and make mysql user as owner

mkdir /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
chmod 750 /var/lib/mysql

3)edit /etc/mysql/mysql.conf.d/mysqld.cnf and add the following line after [mysqld]

lower_case_table_names=1

4) Initialize mysql using the following

mysqld --defaults-file=/etc/mysql/my.cnf --initialize lower_case_table_names=1 --user=mysql --console

Change defaults-file with the actual location of your defaults file. more info on mysql initialization here: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization-mysqld.html

5) (Optional) Repeat

chown -R mysql:mysql /var/lib/mysql
chmod 750 /var/lib/mysql

if owner of the files in /var/lib/mysql is not mysql

6)Start mysql using

sudo service mysql start

7) If everything worked correctly, open mysql using

mysql -u root -p

and by running this query

SHOW VARIABLES where Variable_name like 'lower%';

you will get

'lower_case_table_names', '1'

8)Restore mysql schema using the dump created in step 0.

9)Execute mysql_upgrade to create the sys schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!