当前位置:网站首页>【Kubernetes系列】K8s设置MySQL8大小写不敏感
【Kubernetes系列】K8s设置MySQL8大小写不敏感
2022-06-30 13:06:00 【奔跑吧邓邓子】
目录
一、MySQL8 设置大小写敏感配置的方式
MySQL 通过 lower_case_table_names 来进行大小写敏感设置,0 为敏感,1 为不敏感,默认为 0。
根据 MySQL 官方文档,lower_case_table_names 只有在初始化时设置才有效,初始化后再更改这个参数是不起效的。
因此,可以通过以下方法设置:
1.初始化时带参数
初始化时带上如下参数:
–initialize --lower_case_table_names=1
2.初始化前,在 my.cnf 加入 lower_case_table_names 配置
vi /etc/my.cnf
在 [mysqld] 一节加入:
lower_case_table_names=1
二、已安装 MySQL8 的设置方法
1.停止 MySQL
systemctl stop mysqld
2.删除数据目录
rm -rf /var/lib/mysql
3.修改配置文件
vi /etc/my.cnf
在 [mysqld] 一节加入:
lower_case_table_names=1
4.启动 MySQL
systemctl start mysqld
三、K8s 下的设置方法
1.删除挂载的数据目录
如下,则删除 /home/data/mysql 目录的数据:
spec:
...
volumeMounts:
- name: mysql-data-volumes
mountPath: /var/lib/mysql
volumes:
- name: mysql-data-volumes
hostPath:
path: /home/data/mysql
type: Directory
2.yml 文件增加 lower_case_table_names 配置
如下:
spec:
serviceName: mysql
replicas: 1
selector:
matchLabels:
shop.service: mysql
template:
metadata:
labels:
shop.service: mysql
spec:
containers:
- args:
- --lower_case_table_names=1
或
data:
my.cnf: |
[mysqld]
lower_case_table_names=1
边栏推荐
- Apache Doris Compaction优化百科全书
- JMeter learning notes
- Kaniko official documents - build images in kubernetes
- Mqtt ROS simulates publishing a custom message type
- In line with the trend of media integration, Zhongke Wenge and Meishe jointly create digital intelligence media publicity
- SQL programming problem, test case failed
- 为基础性语言摇旗呐喊
- Exploring the source code of Boca Cross Chain Communication: Elements
- 知识传播不能取代专业学习!
- 【系统分析师之路】第五章 复盘软件工程(敏捷开发)
猜你喜欢
In line with the trend of media integration, Zhongke Wenge and Meishe jointly create digital intelligence media publicity
JS converts an array to a two-dimensional array based on the same value
[Title brushing] heater
步骤详解 | 助您轻松提交 Google Play 数据安全表单
Resource realization applet opening wechat official small store tutorial
一篇文章读懂关于企业IM的所有知识点
Goods and services - platform properties
正则系列之断言Assertions
ABAP工具箱 V1.0(附实现思路)
Google Earth Engine(GEE)——将字符串的转化为数字并且应用于时间搜索( ee.Date.fromYMD)
随机推荐
Unity 频繁切换分支 结果模型出现莫名其妙的错误
【刷题篇】避免洪水泛滥
正则系列之断言Assertions
Embedded development: five C features that may no longer be prohibited
数字时代,XDR(扩展检测与响应)的无限可能
半导体动态杂谈
PG Basics - logical structure management (table inheritance, partition table)
Open source of xinzhibao applet
Wechat applet reports an error: typeerror: cannot read property 'SetData' of undefined
Development of unity script program
VisualStudio and SQL
postman 自動生成 curl 代碼片段
Derivation of Park transformation formula for motor control
损失函数:DIOU loss手写实现
Postman génère automatiquement des fragments de code Curl
腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?
Rk356x u-boot Institute (command section) 3.3 env related command usage
How can I protect my private key?
Mqtt ROS simulates publishing a custom message type
可观测,才可靠:云上自动化运维CloudOps系列沙龙 第一弹