Debian mariadb 10.11设定表名 大小写不敏感方法

目录

问题表现:应用中查询 表提示 表不存在  

处理步骤:

1、查询表名大小写敏感情况: show global variables like '%case%';

2、修改mariadb 配置设置大小写 不敏感

mysql 配置大小写不敏感

mariadb 10.11设置表名大小写不敏感

 /etc/mysql/mariadb.conf.d/ 目录下的文件

总结:在mariadb 10.11以及以后的版本中,要配置表名大小写敏感问题,一般修改修改配置文件:/etc/mysql/mariadb.conf.d/50-server.cnf 在  [mysqld] 段 添加属性:lower_case_table_names=1 然后重启服务


问题表现:应用中查询 表提示 表不存在  

 问题处理办法: 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.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# If you are new to MariaDB, check out https://mariadb.com/kb/en/basic-mariadb-articles/

#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
# Port or socket location where to connect
port = 3306
socket = /run/mysqld/mysqld.sock

[mysqld]
lower_case_table_names=1

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
 

关键信息:# 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.cnf" to set user-specific options. 

可以看到 读取的配置文件顺序为:

1、 /etc/mysql/my.cnf、

2、/etc/mysql/mariadb.cnf、

3、/etc/mysql/conf.d/*.cnf  

4、/etc/mysql/mariadb.conf.d/ 以及 ~/.my.cnf

结合说明,可以发现 以往的

 [mysqld]
lower_case_table_names=1 在 
/etc/mysql/my.cnf 是没有生效的。 

查看其他配置文件: cat /etc/mysql/mariadb.cnf

 cat /etc/mysql/mariadb.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.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# If you are new to MariaDB, check out https://mariadb.com/kb/en/basic-mariadb-articles/

#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
# Port or socket location where to connect
port = 3306
socket = /run/mysqld/mysqld.sock

[mysqld]
lower_case_table_names=1

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
 

可以看到 在 /etc/mysql/mariadb.cnf 中设置 [mysqld]
lower_case_table_names=1 也是无效的。 

查看其他配置文件:

在/etc/mysql/conf.d文件夹下有:mysql.cnf 以及 mysqldump.cnf
 

cat mysql.cnf 

可见:mysql段的设定单独提取到了:/etc/mysql/conf.d/mysql.cnf 里:

尝试 在/etc/mysql/conf.d/mysql.cnf 里加上 lower_case_table_names=1  :

然后重启 mariadb 服务再验证:

直接报错:mysql: unknown variable 'lower_case_table_names=1'  可见这种方式也不行。需要把配置文件 /etc/mysql/conf.d/mysql.cnf 还原回来。 

 /etc/mysql/mariadb.conf.d/ 目录下的文件

先看一下 /etc/mysql/mariadb.conf.d/ 目录下的文件:

实在不知道 文件用处,直接cat  查看,比如,当前我使用的这个mariadb 10.11的版本 

50-client.cnf文件内容:


#
# This group is read by the client library
# Use it for options that affect all clients, but not the server
#

[client]
# Example of client certificate usage
#ssl-cert = /etc/mysql/client-cert.pem
#ssl-key  = /etc/mysql/client-key.pem
#
# Allow only TLS encrypted connections
#ssl-verify-server-cert = on

# This group is *never* read by mysql client library, though this
# /etc/mysql/mariadb.cnf.d/client.cnf file is not read by Oracle MySQL
# client anyway.
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]
default-character-set=utf8mb4
 

 50-server.cnf 文件内容如下:
 

 
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#

#user                    = mysql
pid-file                = /run/mysqld/mysqld.pid
basedir                 = /usr
#datadir                 = /var/lib/mysql
#tmpdir                  = /tmp

# Broken reverse DNS slows down connections considerably and name resolve is
# safe to skip if there are no "host by domain name" access grants
#skip-name-resolve

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

#
# * Fine Tuning
#

#key_buffer_size        = 128M
#max_allowed_packet     = 1G
#thread_stack           = 192K
#thread_cache_size      = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
#myisam_recover_options = BACKUP
#max_connections        = 100
#table_cache            = 64

#
# * Logging and Replication
#

# Note: The configured log file or its directory need to be created
# and be writable by the mysql user, e.g.:
# $ sudo mkdir -m 2750 /var/log/mysql
# $ sudo chown mysql /var/log/mysql

# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# Recommend only changing this at runtime for short testing periods if needed!
#general_log_file       = /var/log/mysql/mysql.log
#general_log            = 1

# When running under systemd, error logging goes via stdout/stderr to journald
# and when running legacy init error logging goes to syslog due to
# /etc/mysql/conf.d/mariadb.conf.d/50-mysqld_safe.cnf
# Enable this if you want to have error logging into a separate file
#log_error = /var/log/mysql/error.log
# Enable the slow query log to see queries with especially long duration
#log_slow_query_file    = /var/log/mysql/mariadb-slow.log
#log_slow_query_time    = 10
#log_slow_verbosity     = query_plan,explain
#log-queries-not-using-indexes
#log_slow_min_examined_row_limit = 1000

# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
#max_binlog_size        = 100M

#
# * SSL/TLS
#

# For documentation, please read
# https://mariadb.com/kb/en/securing-connections-for-client-and-server/
#ssl-ca = /etc/mysql/cacert.pem
#ssl-cert = /etc/mysql/server-cert.pem
#ssl-key = /etc/mysql/server-key.pem
#require-secure-transport = on

#
# * Character sets
#

# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

#
# * InnoDB
#

# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# Most important is to give InnoDB 80 % of the system RAM for buffer use:
# https://mariadb.com/kb/en/innodb-system-variables/#innodb_buffer_pool_size
#innodb_buffer_pool_size = 8G

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.11 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.11]
 

发现在 50-server.cnf文件中 有 [mysqld] 段的配置,尝试把 表名 大小写 敏感设定写在这里:

即:/etc/mysql/mariadb.conf.d/50-server.cnf

然后重启: systemctl restart mariadb

再登录,查看表名大小写敏感设置: show global variables like '%case%';

总结:在mariadb 10.11以及以后的版本中,要配置表名大小写敏感问题,一般修改修改配置文件:/etc/mysql/mariadb.conf.d/50-server.cnf 在  [mysqld] 段 添加属性:lower_case_table_names=1 然后重启服务

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/595631.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【项目部署】手把手带你从零部署项目:宝塔 + uwsgi + Django + 腾讯云 + Websocket

1. 前言 哈喽,大家好,我是jiaoxingk。今天带来的是有关Django项目部署的教程。 当我们完成了一个项目作品之后,我们肯定会迫不及待的就准备上线部署啦, 这篇教程将带你从服务器的配置选购,再通过安装宝塔的形式进行项目…

【一刷《剑指Offer》】面试题 15:链表中倒数第 k 个结点

力扣对应题目链接:LCR 140. 训练计划 II - 力扣(LeetCode) 核心考点 :链表,前后指针的使用,边界条件检测。 一、《剑指Offer》内容 二、分析问题 较优解题思路: 题目中的链表是单链表&#xff0…

数据库SQL语言实战(七)

前言 这次的有一点点难~~~~~我也写了好久 练习题 题目一 在学生表pub.student中统计名字(姓名的第一位是姓氏,其余为名字,不考虑复姓)的使用的频率,将统计结果放入表test5_01中 create table test5_01(First_name…

Mars3d实现用一个button控制一个map.control的显示与隐藏

原生js,想做一个button,控制比如compass的显示与隐藏 点一下显示 再次单击的时候就隐藏掉 写了一个function控制显示隐藏 function addCompass(){ if(compass.showtrue) { compass.showfalse; } else{ compass.showtrue; } } 功能示例(Vue版) | Mars3D三维可视化平台 | 火星…

corCTF2023 -- kcipher

前言 本次仅仅是通过 modprobe_path 拿 flag,但是 modprobe_path 是可以提权的(:只需要把 /etc/passwd 的权限修改为 777 即可 这里存在 kmalloc-96 大小的 UAF/Double free 所以其实利用方式挺多的~~~但是这里就不深究了 题目分析 内核版…

实测好评!微信自动回复消息神器!高效沟通拿捏住!

随着企业规模的扩大和客户数量的增加,有效管理和回复每一条消息变得越来越具有挑战性。今天,就给大家分享一个高效的自动回复消息神器——个微管理系统,让你能够轻松应对各种沟通需求。 1、自动通过好友,提高沟通效率 每当有新的…

Shell脚本编写-定时清空文件内容,定时记录文件内容大小

find命令 – 根据路径和条件搜索指定文件 – Linux命令大全(手册)find命令的功能是根据给定的路径和条件查找相关文件或目录,其参数灵活方便,且支持正则表达式,结合管道符后能够实现更加复杂的功能,是Linux系统运维人员必须掌握的…

基于现有语言大模型,定制“人人AI气象”公众号天气助手

最近,月之暗面的Kimi大模型非常受欢迎,尝试用了moonshot(128K)基座模型,通过调用各种公开渠道的API,简易实现了一个天气助手,可以回答天气相关的基础概念、原理、应用等方面的问题,同时也可调用多个插件获取…

ComfyUI搭建和注意事项for WIN[笔记]

下载ComfyUI(GitHub - comfyanonymous/ComfyUI: The most powerful and modular stable diffusion GUI, api and backend with a graph/nodes interface.) 从源码上搭建比较麻烦,一般不推荐,所以跑到release里面找一个下载。我的显卡是GeFore GTX 1050 …

【ITK统计】第一期 分类器

很高兴在雪易的CSDN遇见你 VTK技术爱好者 QQ:870202403 公众号:VTK忠粉 前言 本文分享ITK中的分类器及其使用情况,希望对各位小伙伴有所帮助! 感谢各位小伙伴的点赞+关注,小易会继续努力分享,一起进步! 你的点赞就是我的动力(^U^)ノ~YO 在统计分…

私域流量引流方式有哪些?

私域流量引流的方法无非是营销渠道投放、各平台KOL投放、自有自媒体平台账号内容引流、线下引流、老客户转介绍裂变等几个方面,下面对各种不同方法进行简单介绍。 1、营销渠道投放:选择广点通、粉丝通、某些app的信息流和dou等大平台自带的推广渠道工具…

JavaScript中的事件模型

JavaScript中的事件模型分为:事件和事件流、原始事件、标准事件和IE事件。 事件与事件流 JavaScript中的事件,可以理解为HTML文档或者浏览器中发生的一种交互操作,让网页有互动的功能。常见的事件就是加载事件、鼠标事件和自定义事件。 因…

JavaScript中Math函数与舍入

立方根 console.log(Math.sqrt(25)); //数学方式25平方根 console.log(25 ** (1 / 2)); //25的0.5次方 console.log(8 ** (1 / 3)); //8的1/3次方计算最大最小值 console.log(Math.max(1, 5, 88, 22, 132)); //返回最大值 console.log(Math.max(1, 5, 88, 22, 132)); //…

STM32CubeMX学习笔记29---FreeRTOS任务通知

一、简介 1 、基本概念 FreeRTOS 从 V8.2.0 版本开始提供任务通知这个功能,每个任务都有 一个 32 位 的通知值,在大多数情况下,任务通知可以 替代二值信号量、计数信号量、事件组,也可以替代长度为 1 的队列(可以保存…

wordpress外贸建站公司歪建站新版网站上线

wordpress外贸建站公司 歪猫建站 歪猫WordPress外贸建站,专业从事WordPress多语言外贸小语种网站建设与外贸网站海个推广、Google SEO搜索引擎优化等服务。 https://www.waimaoyes.com/dongguan

一键 input 苹果 OpenELM,零门槛 Llama 3 教程,40+ 优质模型/数据集/教程,建议收藏!...

现在 AI 行业什么最火? 「大模型」一定仍然排在前三甲的位置。 自从 2022 年底 ChatGPT 面世以来,大模型在各行各业已经带来了太多的惊喜,应用场景愈发丰富,同时也带动了相关底层技术的普及与普适化。尤其是在开源模型繁荣发展之下…

拼多多标准推广怎么开出自然流量呢

拼多多标准推广开出自然流量的策略如下: 拼多多推广可以使用3an推客。3an推客(CPS模式)给商家提供的营销工具,由商家自主设置佣金比例,激励推广者去帮助商家推广商品链接,按最终有效交易金额支付佣金&…

408数据结构-树与森林 自学知识点整理

前置知识:树的基本概念与性质 树的存储结构 树既可以采用顺序存储结构,又可采用链式存储结构。但无论采取哪种方式,都要求能够唯一地反映树中各结点之间的逻辑关系。 1. 双亲表示法 这种存储结构采用一组连续空间来存储每个结点&#xff0…

柯桥西语培训之在西班牙旅游点菜哪些坑不能踩?

Por muy bien que se coma en Espaa —que es mucho— hay una cosa innegable: lo que pasa en la cocina se queda en la cocina. No todos los alimentos son igualmente seguros o sabrosos cuando se encuentran fuera de la comodidad de nuestra propia casa. Ya sea po…

Linux网络服务的存储,FTP服务和NFS共享

目录 一.存储 1.存储类型 2.应用场景 二.FTP服务 1.FTP工作原理介绍 2.FTP协议的两种模式 3.用户类型 4.匿名用户案例 三.NFS 1.NFS简介 2.NFS服务主要进程 3.NFS特点 4.NFS共享配置文件格式 5.NFS工具 5.1 exportfs 5.2 showmount 5.3 mount.nfs 6.创建文…
最新文章