Moving Java (Spring, Hibernate, MySql) project from Windows to Debian
I am writing project on Windows (IntelliJIdea), and all OK. It compiles, and runs. But when I try to run on Debian(GNU/Linux 5.0), I have
SEVERE: Access denied for user 'root'@'localhost' (using password: YES)
[java] 30.11.2010 15:39:04 org.hibernate.cfg.SettingsFactory buildSettings
[java] WARNING: Could not obtain connection to query metadata
[java] java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
[java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919)
I use such Spring config:
<bean id="mySqlDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://127.0.0.1:3306/mydb"/>
<property name="username" value="mydb"/>
<property name="password" value="Fallout_3"/>
</bean>
<bean id="mySqlSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="mySqlDataSource"/>
<property name="mappingResources">
<list>
<value>entities/ClientPrices.hbm.xml</value>
<value>entities/User.hbm.xml</value>
<value>entities/Provider.hbm.xml</value>
<value>entities/MessageQueue.hbm.xml</value>
<value> hibernate/SimpleEntity.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create开发者_运维技巧
hibernate.current_session_context_class=thread
</value>
</property>
</bean>
You need to add permission to root for localhost in your mysql server
execute :
GRANT ALL ON *.* TO 'root'@'localhost';
on your mysql console.
- Resource
精彩评论