繁体   English   中英

在Linux中连接到mysql后找不到数据库

[英]cannot find database after connecting to mysql in linux

Linux-Ubuntu问题:与mysql建立连接后找不到mysql数据库

1. I have a war file deployed in webapps folder at /srv/apache-tomcat-7.0.53/webapps/
War name is InIndia.war

2. I have deployed inindiadb.properties in classpath which is /srv/apache-tomcat-7.0.53/lib

Contents of inindiadb.properties

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/inindia
jdbc.username=root
jdbc.password=admin

3. I have mysql installed and running

netstat -vulntp |grep -i mysql
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      563/mysqld

4. MySql Database has inindia database and inindia has 3 tables (place , user_roles , users)

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| inindia            |

| mysql              |

| performance_schema |

| test               |

+--------------------+

5 rows in set (0.00 sec)

mysql> use inindia;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;

+-------------------+

| Tables_in_inindia |

+-------------------+

| place             |

| user_roles        |

| users             |

+-------------------+

3 rows in set (0.00 sec)


5. The problem is when I restart my tomcat , a connection is made to the mysql but in tomcat logs it says that 

**catalina.out**

SEVERE: Error listenerStart
Apr 18, 2014 11:02:17 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/InIndia] startup failed due to previous errors


**localhostlocalhost.2014-04-18.log**

INFO: Initializing Spring root WebApplicationContext
Apr 18, 2014 10:50:11 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.inindia.listener.ApplicationInfoLoaderListener
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT * FROM PLACE order by placeName]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'inindia.PLACE' doesn't exist
  • 我无法找出错误。 该错误表明无法找到inindia.Place,但是存在数据库以及表。
  • 它连接到inindiadb.properties文件中提到的URL。
  • 我什至编写了一个Java类来连接到mysql服务器,并显示为表之一的输出数据。 连接和数据获取均成功。

  • 甚至我在Windows的本地tomcat上也部署了相同的东西,因此部署正确。因此战争似乎没有问题

我是linux新手,请告诉我mysql服务器中是否需要进行任何设置,例如赋予数据库特权或类似功能

表名区分大小写。 使用适当的情况

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM