Home > Database > Mysql Tutorial > linux/centos下设置Mysql表名不区分大小写_MySQL

linux/centos下设置Mysql表名不区分大小写_MySQL

WBOY
Release: 2016-06-01 13:02:58
Original
1146 people have browsed it

情景:公司近期在将数据库从ORACLE转为MYSQL,由于之前在ORACLE中表名是不区分大小写,因此到mysql中就出现了找不到表的问题,经上网查询,发现在linux下mysql的表名是区分大小写的,但是有参数可以使其不区分大小写。

一、linux中mysql大小写详情:
1、数据库名严格区分大小写
2、表名严格区分大小写的
3、表的别名严格区分大小写
4、变量名严格区分大小写
5、列名在所有的情况下均忽略大小写
6、列的别名在所有的情况下均忽略大小写

二、添加参数使其不区分大小写
1、切换到root用户
$ su - root
2、修改/etc/my.cof配置文件,
# sed -i '/\[mysqld\]/a\lower_case_table_names=1' /etc/my.cnf

lower_case_table_names参数详解:
0:区分大小写
1:不区分大小写

3、重启mysql
# service mysqld restart

4、查看mqsql参数
# mysql -uroot -p
> show variables like "%case%" ;
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
+------------------------+-------+
2 rows in set (0.00 sec)

三、其他

在Windows中,MYSQL一直都是不区分大小写的。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template