mysql - 无法重命名mysql表

标签 mysql table-rename

我正在尝试使用此 SQL 重命名我的表。我在 Windows XP 上使用 MySQL 5.1.41。

USE 'bobby_tables';

    ALTER TABLE gc_acompte_fournisseur
      RENAME TO GC_Acompte_Fournisseur;

查询声称已正确执行,但它在撒谎!我的表名还是全小写!

我遇到了什么肮脏的奥术,禁止我利用我的 table ?

最佳答案

这就是 MySQL 在 Windows 上的工作方式:

http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_lower_case_table_names

  • lower_case_table_names

If set to 0, table names are stored as specified and comparisons are case sensitive. If set to 1, table names are stored in lowercase on disk and comparisons are not case sensitive. If set to 2, table names are stored as given but compared in lowercase. This option also applies to database names and table aliases. For additional information, see Section 8.2.2, “Identifier Case Sensitivity”.

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 set this variable to 0 on such a system and access MyISAM tablenames using different lettercases, index corruption may result. On Windows the default value is 1. On Mac OS X, the default value is 2.

If you are using InnoDB tables, you should set this variable to 1 on all platforms to force names to be converted to lowercase.

(强调我的)

关于mysql - 无法重命名mysql表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4934705/

相关文章:

mysql - 我不知道/分组依据?有?子查询?我可以用什么?

mysql - 如何使用mysql连接两个属性相同但每个表中数据不同的表

database - 在保留现有触发器的同时重命名表

sql - 重命名 Oracle 表

mysql - 如何限制数据库表中的 HTML/Javascript 插入 Laravel 5.2

mysql - Mysql数据库中的空间

MySQL 全文搜索 boolean 模式部分匹配

sql - 更改 Oracle 表名

sql - 使用 PostgreSQL 在一个语句中重命名多个列