Home > Database > Mysql Tutorial > Linux下设置MySQL不区分大小写_MySQL

Linux下设置MySQL不区分大小写_MySQL

WBOY
Release: 2016-06-01 13:01:36
Original
1302 people have browsed it

MySQL在Linux下数据库名、表名、列名、别名大小写规则:
   1、数据库名与表名是严格区分大小写
   2、表的别名是严格区分大小写
   3、列名与列的别名在所有的情况下均是忽略大小写的
   4、变量名也是严格区分大小写的
注意:
A、Linux下MySQL安装完后默认:区分表名的大小写,不区分列名的大小写
B、改变表名的大小写区分规则的方法:用root帐号登录,在/etc/my.cnf 或 /etc/mysql/my.cnf 中的[mysqld]下面添加添加lower_case_table_names=1

# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# add here
lower_case_table_names=1
Copy after login

 

重启MySQL服务,若设置成功,则不再区分表名大小写。

 

MySQL在Windows下数据库名、表名、列名、别名都不区分大小写。

如果想大小写区分则在my.ini 里面的mysqld部分

加入 lower_case_table_names=0

注意:Windows中即使改了这个设置,在查询时还是不会区分大小写。只是在导入导出时会对大小写有区别。

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