参考:lowercase - lower_case_table_names=1 on Ubuntu 18.04 doesn't let mysql to start - Stack Overflow
下面用户:Florin Tintea 的回答
mysql 的安装直接使用
apt-get install mysql-server
即可。但是mysql8在初始化后不允许配置大小写敏感。修改配置文件都没用。
解决方案是:1.先安装;2.修改配置文件,添加lower_case_table_names=1,备份该配置文件;3.卸载mysql;4.保留修改后的配置文件的情况下重装mysql;
原文:
This worked for me on a fresh Ubuntu Server 20.04 installation with MySQL 8.0.20 (no existing databases to care about - so if you have important data then you should backup/export it elsewhere before doing this):
So... I did everything with elevated permissions:
sudo su
Install MySQL (if not already installed):
apt-get install mysql-server
Backup configuration file, uninstall it, delete all databases and MySQL related data:
cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf.backup
service mysql stop
apt-get --purge autoremove mysql-server
rm -R /var/lib/mysql
Restore saved configuration file, edit the file (add a line just under [mysqld] line):
cp /etc/mysql/mysql.conf.d/mysqld.cnf.backup /etc/mysql/mysql.conf.d/mysqld.cnf
vim /etc/mysql/mysql.conf.d/mysqld.cnf
...
lower_case_table_names=1
...
Reinstall MySQL (keeping the configuration file), configure additional settings:
apt-get install mysql-server
service mysql start
mysql_secure_installation
mysql
SHOW VARIABLES LIKE 'lower_case_%';
exit
最后重新安装mysql时,会提示本地已经有mysqld.cnf这个配置文件,让你选使用下载来的包里的配置文件还是你本地的。记得选本地的,不要让他覆盖回去。