目录
1、查询表名大小写敏感情况: show global variables like '%case%';
/etc/mysql/mariadb.conf.d/ 目录下的文件
问题表现:应用中查询 表提示 表不存在
问题处理办法: 1、先确认表存在,然后再确认数据库中表名的大小写。与mysql 一致再 mariadb中:
lower_case_file_system:表示当前系统文件是否大小写敏感(ON为不敏感,OFF为敏感),只读参数,无法修改。
lower_case_table_names:表示表名是否大小写敏感,可以修改。
lower_case_table_names = 0时,mysql会根据表名直接操作,大小写敏感
lower_case_table_names = 1时,大小写不敏感,mysql会先把表名转为小写,再执行操作。
处理步骤:
1、查询表名大小写敏感情况: show global variables like '%case%';
2、mariadb 配置设置大小写 不敏感
mariadb虽说与mysql类似,但是从mariadb 10.11开始,与mysql配置是有明显区别的(至少我这里看到是这样,具体哪个版本开始不一样,我也不知道...)
mysql 配置大小写不敏感
mysql 配置大小写不敏感操作如下:实际上以前版本的mariadb也可以这样做:
vi /etc/my.cnf 通过配置文件/etc/my.cnf下的【mysqld】添加如下内容:
lower_case_table_names=1 |
设置好之后,重启数据库服务。
mariadb 10.11设置表名大小写不敏感
在 debian 12环境中,mariadb 10.11已经没有 /etc/my.cnf配置文件了 :
通过find / -name my.cnf 可以查询到 :
配置文件变成了:/etc/mysql/my.cnf
查看配置文件:/etc/mysql/my.cnf
可以发现内容如下:
# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read.
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cn