我试图使用ecto.migrate在我的mysql会话上安装表。
但是,即使ecto.create已经成功,Ecto.migrate也会失败并显示以下错误消息:
15:53:20.563 [error] GenServer #PID<0.319.0> terminating
** (stop) %Mariaex.Error{mariadb: %{code: 1049, message: "Unknown database 'msg_gtw_dev'"}, message: nil}
Last message: nil
State: [sock_mod: Mariaex.Connection.Tcp, timeout: 5000, otp_app: :msg_gtw, repo: MsgGtw.Repo, adapter: Ecto.Adapters.MySQL, username: "root", password: "root", database: "msg_gtw_dev", hostname: "localhost", port: 3306]
检查出mysql后,数据库存在:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| msg_gtw_dev |
| mysql |
| objectstore_dev |
| performance_schema |
| test |
+--------------------+
6 rows in set (0,00 sec)
我目前正在使用mac OS X el capitan,而这个确切的项目在Ubuntu 16.04 LTS上运行良好
iex -> 1.2.6
erl -> R18
ecto -> 1.1.9
编辑:(由neydroid提问)
这是配置:
# Configure your database
config :msg_gtw, MsgGtw.Repo,
adapter: Ecto.Adapters.MySQL,
username: "root",
password: "root",
database: "msg_gtw_dev",
hostname: "127.0.0.1",
pool_size: 10
有什么想法吗?解决方案解决?提示&amp;招数? ; - )