apt-get install mysql-server
mysql8在初始化后不允许配置大小写敏感。修改配置文件也没用
解决方案:
- 先安装;
- 修改配置文件,添加lower_case_table_names=1,备份该配置文件;
- 卸载mysql;
- 保留修改后的配置文件的情况下重装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:
# Install MySQL 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 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 sudo mysql -uroot -p SHOW VARIABLES LIKE 'lower_case_%'; exit
重新安装mysql时,会提示本地已经有mysqld.cnf这个配置文件,让你选使用下载来的包里的配置文件还是你本地的。记得选本地的,不要让他覆盖回去。