mariadb在Linux环境下大小写敏感

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

[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环境下大小写敏感

上一篇:iOS Masonry 使用小记(MASConstraint、center、centerX、edges、equalTo、greaterThanOrEqualTo)


下一篇:iOS UICollectionView实现动态标签(单选、多选)