lower_case_table_names = 1 很有用
mysql5.X 只要配置里有了就行了
但是8不行,需要文件夹和配置里都有!否则就报错 不启动
但是 直接改是改不了的,需要初始化数据库的时候就加上
可ubuntu自己就初始化了数据库 那么就得先删掉自己创建的库
然后
lower_case_table_names = 1 加到my.conf里 重新初始化数据库
但是ubuntu20.04的apparmor又不允许用户
/sbin/mysqld --initialize --lower-case-table-names=1 --user=mysql
那么就只能靠dpkg-reconfigure了
sudo dpkg-reconfigure mysql-server-8.0
执行这个,它会按照my.conf的配置重新初始化数据库的。。。。
有图有真相。。。
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.20-0ubuntu0.20.04.1 (Ubuntu)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show global variables like "%lower%";
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
+------------------------+-------+
2 rows in set (0.00 sec)
在Ubuntu 20.04上安装MySQL 8时,设置`lower_case_table_names = 1`遇到挑战。不同于MySQL 5.x,MySQL 8需要在文件夹名和配置中都设置此选项,否则服务无法启动。由于Ubuntu已预先初始化数据库,必须删除现有库,将该选项加入my.cnf,并重新初始化。然而,Ubuntu的AppArmor限制了用户直接操作。通过运行`dpkg-reconfigure`命令,可以按照my.cnf配置重新初始化数据库,成功解决该问题。
4713





