2016-09-13 174 views
0

我跟进播放2.5文档Play2.5 MySQL数据库连接错误:无法连接到数据库(分贝)

MySQL数据库引擎的连接属性

# Default database configuration using MySQL database engine 
# Connect to playdb as playdbuser 
db.default.driver=com.mysql.jdbc.Driver 
db.default.url="jdbc:mysql://localhost/playdb" 
db.default.username=playdbuser 
db.default.password="a strong password" 

添加以下行到application.conf

# Default database configuration using MySQL database engine 
# Connect to playdb as playdbuser 
db.default.driver=com.mysql.jdbc.Driver 
db.default.url="jdbc:mysql://localhost/playdb" 
db.default.username=root 
db.default.password="password" 

我得到了错误

Configuration error 
Cannot connect to database [db] 

我在Mac上使用本地mysql进行测试。用户名和密码是正确的。

并创建playdb数据库。

mysql> show databases; + --------------------- + |数据库| + --------------------- + | information_schema | | library_development | | library_production | | library_test | | mysql | | performance_schema | | playdb | | sys | + --------------------- + 8行中集合(0.00秒)

由于

+0

可以显示完整的堆栈跟踪吗? – Salem

+0

谢谢彼得: http://stackoverflow.com/questions/38169619/connect-mysql-database-with-play-framework-2-5 好的。与此线程重复。 我需要删除数据库。从设置。 – searain

回答