首页 > 数据库技术 > 详细

mariadb在Linux环境下大小写敏感

时间:2021-09-01 17:54:15      阅读:19      评论:0      收藏:0      [点我收藏+]

查看当前数据库大小写敏感配置:

[root@iZ2zehcucevs54589utu1eZ ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 235
Server version: 10.6.4-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type help; or \h for help. Type \c to clear the current input statement.

MariaDB [(none)]>  show variables like %case%;
+-----------------------------------------+-------+
| Variable_name                           | Value |
+-----------------------------------------+-------+
| lower_case_file_system                  | OFF   |
| lower_case_table_names                  | 0     |
| simple_password_check_letters_same_case | 1     |
+-----------------------------------------+-------+
3 rows in set (0.001 sec)

MariaDB [(none)]> 

参数含义:

lower_case_table_names: 此参数不可以动态修改,必须重启数据库
lower_case_table_names = 1  表名存储在磁盘是小写的,但是比较的时候是不区分大小写
lower_case_table_names=0  表名存储为给定的大小和比较是区分大小写的 
lower_case_table_names=2, 表名存储为给定的大小写但是比较的时候是小写的

修改方式:

修改/etc/my.cnf,添加如下内容:

[mysqld]
lower_case_table_names=1

添加后重启数据库,并查看修改状态:

[root@iZ2zehcucevs54589utu1eZ ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.6.4-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type help; or \h for help. Type \c to clear the current input statement.

MariaDB [(none)]>  show variables like %case%;
+-----------------------------------------+-------+
| Variable_name                           | Value |
+-----------------------------------------+-------+
| lower_case_file_system                  | OFF   |
| lower_case_table_names                  | 1     |
| simple_password_check_letters_same_case | 1     |
+-----------------------------------------+-------+
3 rows in set (0.001 sec)

 

mariadb在Linux环境下大小写敏感

原文:https://www.cnblogs.com/mliu/p/15210971.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!