我正在尝试使用此 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/