我刚刚开始使用Hibernate,当我最终尝试启动web-app时,我收到以下错误:
2012-nov-14 12:54:23 org.hibernate.tool.hbm2ddl.SchemaExport execute
ERROR: HHH000231: Schema export unsuccessful
java.sql.SQLException: null, message from server: “Host ‘192.168.1.7’ is not allowed to
connect to this MySQL server”
这真是令人沮丧.为什么我不是本地主机?什么是192.168.1.7?我可以授予像类似问题的答案所说的特权,但为什么我不是localhost呢?
我理解这里的问题,hbm2ddl设置被设置为create,所以它想要创建给定的表但是没有得到MySQL服务器的许可.
我正在Eclipse中开发一个struts2 / hibernate应用程序,我使用Tomcat,当然还有MYSQL.
提前致谢!
编辑:(hibernate.cfg.xml)
/p>
“-//Hibernate/Hibernate Configuration DTD//EN”
“http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd”>
com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/clothes
root
root
1
org.hibernate.dialect.MySQLDialect
true
create