mysql server有个参数叫做 lower_case_table_names,控制表名、字段名的大小写
它可以有3个值:
0:大小写敏感
1:比较名字时 忽略大小写,但创建表时,大写字母也转为小写字母。
2:比较名字时 忽略大小写,创建表时,维持原样。

查看:

 

[root@bbmg-law-test-01 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1745
Server version: 5.7.33 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show variables like 'lower_case_table_names';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_table_names | 0     |
+------------------------+-------+
1 row in set (0.00 sec)

 

 

修改:

在my.cnf配置文件中[mysqld]标签的作用区域,增加lower_case_table_names=1的配置,然后重启MySQL服务

[root@bbmg-law-test-01 ~]# vim /etc/my.cnf

在mysqld下 添加或修改 lower_case_table_names = 1

Mysql修改lower_case_table_names

[root@bbmg-law-test-01 ~]# service mysqld restart

 

再次查看:

    Mysql修改lower_case_table_names

 

相关文章:

  • 2022-02-14
  • 2022-12-23
  • 2022-03-05
  • 2021-05-18
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-09
  • 2021-07-31
  • 2022-12-23
  • 2022-01-01
  • 2021-04-07
  • 2021-08-04
  • 2021-10-18
相关资源
相似解决方案