> 数据库 > MySQL >

mysql 查询表出错 提示表不存在

错误提示如下:

select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist

select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist
select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist
select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist
select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist
select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist
select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist
select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist

select AlarmType,RefreshTime from CLD_AlarmSetting where 1=1  ExecuteData Table 'cldcustdata.CLD_AlarmSetting' doesn't exist

 

原因:表名为大写,找不到表

 

解决办法:

编辑mysql配置文件:vi /etc/my.cnf

添加:lower_case_table_names=1 一句到文件中。

 

 

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0


lower_case_table_names=1


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 

 

 

 

重启mysql 问题解决。

(责任编辑:IT)