首页 > 代码库 > hibernate4.2.2使用schemaExport生成数据表报错,junit提示:SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: NO))
hibernate4.2.2使用schemaExport生成数据表报错,junit提示:SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: NO))
给mysql的root授权远程连接
1 mysql -u root –p2 mysql>use mysql;3 mysql>update user set host = ‘%‘ where user = ‘root‘;4 mysql>select host, user from user;
hibernate.cfg.xml的内容
1 <property name="connection.username">root</property>2 <property name="connection.password">0318</property>
junit的测试内容
1 ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure().build();2 3 MetadataImplementor metadataImplementor = (MetadataImplementor)4 new MetadataSources(serviceRegistry).buildMetadata();5 6 SchemaExport export = new SchemaExport(serviceRegistry, metadataImplementor);7 export.create(true, true);
hibernate4.2.2使用schemaExport生成数据表报错,junit提示:SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: NO))
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。