Mysql修改lower_case_table_names


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

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

 

再次查看:

    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM