Linux上的MySQL区分大小写的表名
作者:互联网
将MySQL数据库从Windows迁移到Linux我遇到的问题是,在Linux上,表的名称区分大小写.这是一个问题,因为我正在开发的Java应用程序找不到表.
我更改了我的/etc/mysql/my.cnf文件添加行:
的lower_case_table_names = 1
但这并没有改变任何事情.
我的服务器版本是:
5.1.61-0ubuntu0.11.10.1(Ubuntu)
如何配置MySQL以忽略表名中的大小写?
解决方法:
仅更改lower_case_table_names设置是不够的.需要在导入数据库之前完成.
MySQL 5.1 documentation列出了在Windows和Linux / UNIX之间移动的过程.这将确保遵循您所需的强制区分大小写的规则.看一看并验证您是否按正确的顺序执行了这些步骤:
To convert one or more entire databases, dump them before setting
lower_case_table_names, then drop the databases, and reload them after
setting lower_case_table_names:1 – Use mysqldump to dump each database:
mysqldump –databases db1 > db1.sql
mysqldump –databases db2 >
db2.sql… Do this for each database that must be recreated.
2 – Use DROP DATABASE to drop each database.
3 – Stop the server, set
lower_case_table_names
in the[mysqld]
section of your\etc\mysql\my.cnf
file, and restart the server.4 – Reload the dump file for each database. Because lower_case_table_names
is set, each database and table name will be converted to lowercase as
it is recreated:mysql < db1.sql
mysql < db2.sql
标签:linux,mysql,case-sensitive,mysql-5,mysql-5-1 来源: https://codeday.me/bug/20190805/1592599.html