MySql-不同服务器中表的区分大小写问题 [英] MySql - Case Sensitive issue of tables in different server
问题描述
我正在unix/windows/unix的三台不同服务器中工作.
I am working in three different servers which are unix/windows/unix.
case-1
:在我的Unix服务器上,我有一个表名Country_master及其字段pk_CountryId,CountryName等.
case-1
: In my loacl server which is unix I have one table name Country_master and its fields pk_CountryId, CountryName etc.
case-2
:在我的演示服务器中,它的窗口表名称自动更改为country_master.
case-2
:In my Demo server which is window table name changed automatically to country_master.
case-3
:在我的Live服务器中,该服务器是unix表名称country_master.
case-3
:In my Live server which is unix table name country_master.
但是在我的代码表名称中,我使用的是Country_master,所以它给我这样的错误
But in my code table name i taken is Country_master so it gives me error like this
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'markets.Country_master' doesn't exist'.
我能以其他方式不更改数据库以及代码中的表名吗?
Can i have any way not to change table name in database and also in code but it takes lower case?
推荐答案
如果使用的是MySQL,则可以使用以下指令在my.conf中设置表名和列名区分大小写
If you are using MySQL you can set table and column name case sensitive in my.conf by using following directive
set-variable = lower_case_table_names=1
更新后不要忘记重启服务器.如果在所有服务器中使用相同的列名,那就更好了
Do not forget the restart server after update. It would be better if you use same column names in all servers
这篇关于MySql-不同服务器中表的区分大小写问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!