Why is Hibernate not creating database for MySQL?

后端 未结 3 1721
Happy的楠姐
Happy的楠姐 2021-01-19 03:48

I have following hibernate.cfg.xml:




        
3条回答
  •  死守一世寂寞
    2021-01-19 04:34

    I usually use the properties file to automatically create a database when i'm using Spring, and below is how its done, hope this works so u'll modify this to suite your needs.....

    database.driver=com.mysql.jdbc.Driver
    database.url=jdbc:mysql://localhost:3306/userdb?createDatabaseIfNotExist=true
    database.user=root
    database.password=root
    hibernate.dialect=org.hibernate.dialect.MySQLDialect
    hibernate.show_sql=true
    hibernate.hbm2ddl.auto=create
    

提交回复
热议问题