2016-09-13 179 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

回答