Chinaunix首页 | 论坛 | 博客
  • 博客访问: 327875
  • 博文数量: 87
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 727
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-27 15:56
个人简介

开心了, 就笑;不开心了,就过会儿再笑。。。。

文章分类

全部博文(87)

文章存档

2017年(16)

2016年(28)

2015年(33)

2014年(10)

我的朋友

分类: Mysql/postgreSQL

2015-05-19 16:36:59

从库报错,显示没有UESR_NAME表,可是查询是有该表:show  create table mydb.user_name;

想到可能是 lower_case_table_names  设置的问题,区分大小写了,之后在my.cnf中设置 lower_case_table_names=0后,重启mysql,报错消失。

Mysql官方文档的介绍:

Value

Meaning

0

Table and database names are stored on disk using the lettercase specified in the CREATE TABLE orCREATE 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 orCREATE 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 for lower_case_table_names=1.

 

默认为0,大小写敏感。

设置1,大小写不敏感。创建的表,数据库都是以小写形式存放在磁盘上,对于sql语句都是转换为小写对表和DB进行查找。

设置2,创建的表和DB依据语句上格式存放,凡是查找都是转换为小写进行。

 

If you plan to set the lower_case_table_names system variable to 1 on Unix, you must first convert your old database and table names to lowercase before stopping mysqld and restarting it with the new variable setting. To do this for an individual table, use RENAME TABLE:

 

当想设置lower_case_table_names = 1时,在重启数据库实例之前就需要将原来的数据库和表转换为小写。

 

官方文档的解释。要开启lower_case_table_names = 1 。先要将大写字母数据库更改为小写。否则将找不到数据库名。

 所以要想忽略大小写,还需要提前将大写数据库名更改小写,否则报错。数据库名无法rename.可以新建一个小写的数据库名。
然后rename table 到新的数据库,完成表的迁移。

阅读(3537) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~