mysql数据库如何设置表名大小写不敏感?
转自:https://blog.csdn.net/iefreer/article/details/8313839
在跨平台的程序设计中要注意到mysql的一些系统变量在windows和linux上的缺省值是不同的, 比如mysql表名称的大小写变量.
在windows上lower_case_table_names变量的缺省值为1; 在linux上为0; 在mac os上为2;
该变量值的详细定义如下:
| Value | Meaning |
|---|---|
0 |
Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement. Name comparisons are case sensitive. You should not set this variable to 0 if you are running MySQL on a system that has case-insensitive file names (such as Windows or Mac OS X). If you force this variable to 0 with --lower-case-table-names=0 on a case-insensitive file system and access MyISAM tablenames using different lettercases, index corruption may result. |
1 |
Table names are stored in lowercase on disk and name comparisons are not case sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names and table aliases. |
2 |
Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. This works only on file systems that are not case sensitive! InnoDB table names are stored in lowercase, as forlower_case_table_names=1. |
如果想在linux环境中想设置表名为大小写不敏感, 那么可以通过如下的命令:
mysqld --SET-lower_case_table_names=1;
或者在mysql server的配置文件中添加配置项:
vi /etc/my.cnf
- # The MySQL server
- [mysqld]
- set-variable=lower_case_table_names=1
mysql数据库如何设置表名大小写不敏感?的更多相关文章
- 设置mysql表名大小写不敏感
在跨平台的程序设计中要注意到mysql的一些系统变量在windows和linux上的缺省值是不同的, 比如mysql表名称的大小写变量. 在windows上lower_case_table_names ...
- 更改MYSQL数据库不区分大小写表名
今天郁闷死了,在LINUX下调一个程序老说找不到表,但是我明明是建了表的,在MYSQL的命令行下也可以查到,为什么程序就找不到表呢? 后来请教了一个老师才搞定,原来是LINUX下的MYSQL默认是要区 ...
- Mysql更改表名大小写不敏感
编辑配置文件 vi /etc/my.cnf 在[mysqld]后添加添加 lower_case_table_names=1 重启服务 service mysqld stop service mysql ...
- linux环境下mysql默认是区分表名大小写的
在linux环境下,mysql默认表明是区分大小写的,我们可以查看全局变量发现: mysql> show variables like 'lower%'; +------------------ ...
- windows下mysql数据库表名大小写不敏感
最近新入职,领导让做个小功能先练练手.是一个添加分类的功能,有添加和列表,很简单.功能做完后提交,结果在线上出现一个大大的500. 但是我再本地环境下是正常的,我以为可能是php的版本不一致导致的问题 ...
- mysql 远程登录与表名大小写问题
好久没写博客了,这段时间在学习一个开源的项目,里面使用到了mysql,好久没使用mysql了.在使用过程中遇到了一个问题,远程登陆.报错信息很明显,连接失败.解决思路如下: 1. 首先检查到服务器网络 ...
- MySQL数据库查询所有表名
查找指定库中所有表名 select table_name from information_schema.tables where table_schema='db_name'; 注:替换db_nam ...
- linux 下 设置 MySQL8 表名大小写不敏感方法,解决设置后无法启动 MySQL 服务的问题
在安装完成之后,初始化数据库之前,修改 my.cnf 打开mysql配置文件 vim /etc/my.cnf 在尾部追加一行 lower_case_table_names=1 并保存,然后再初始化数据 ...
- 查询mysql数据库中所有表名
查找所有表的语句 select table_name from information_schema.tables where table_schema='当前数据库';
随机推荐
- oc 阿拉伯数字转中文数字
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; formatter.numberStyle = NSNumberFor ...
- PHPExcel_Reader_Exception: is not recognised as an OLE file in Classes问题解决方法
$filename="student.xlsx";//指定excel文件 $temp=substr($filename,strpos($filename,"." ...
- MongoDB Database Profiler
数据库profiler细粒度收集mongodb的写操作.游标.数据库命令等.可以在数据库级别或者实例级别开启profiling. profiler将收集到的数据写入system.profile集合中. ...
- maven介绍 极客学院
来自极客学院 Apache Maven 是一套软件工程管理和整合工具.基于工程对象模型(POM)的概念,通过一个中央信息管理模块,Maven 能够管理项目的构建.报告和文档. Maven - 概述 M ...
- Atitit .h5文件上传
Atitit .h5文件上传 1. 上传原理1 2. Html1 3. Js2 4. uploadV2.js2 5. upServlet & FileUploadService {3 6. 注 ...
- PHP特性整合(PHP5.X到PHP7.1.x)
Buid-in web server内置了一个简单的Web服务器 把当前目录作为Root Document只需要这条命令即可: php -S localhost:3300 也可以指定其它路径 php ...
- ITDB系统搭建及实时备份
ITDB系统搭建及实时备份 ITDB简介 ITDB一款来自希腊的开源IT资产管理系统,它是基于Web的IT资产信息管理系统.对于那些IT设备较多而又缺少管理IT资产信息工具的公司,ITDB是一个不错的 ...
- [搬运]CORBA中BOA和POA的含义
先来BOA,搬自:http://www.cl.cam.ac.uk/research/dtg/attarchive/omniORB/doc/2.8/omniORB2/node6.html The Bas ...
- form在submit之前使用request.setCharacterEncoding是没用的
点击了submit按钮,就创建了另一个request了 比如你有a.jsp,上面有个form,form的action指向某个Servlet或者Action,那么你在a.jsp页面上写的request. ...
- TCP/IP详解读书笔记:概述
分层 分层是一种很通用的架构模式.通过分层,可以把一个系统分解成多个层,每个层专注于各自的功能,并提供接口给上面的层调用.上面的层不需要了解调用层的详细实现,只依赖于其接口,这就给维护带来了很大的好处 ...