如何使用erlang-mysql-driver连接到我的数据库?

时间:2011-07-28 23:21:49

标签: mysql database erlang

我正在尝试使用erlang-mysql-driver连接到我的MySQL数据库但是没有运气。

我使用以下Erlang代码连接

mysql:start_link(p1,"localhost","myname","mypass","stocks").

我得到的错误信息是:

mysql_recv:108: mysql_recv: Failed connecting to "localhost":3306 : {error,
                                                                 econnrefused}
mysql_conn:361: failed connecting to "localhost":3306 : {error,
                                                     "connect failed : {error,econnrefused}"}
mysql:511: failed starting first MySQL connection handler, exiting
** exception exit: {badfun,undefined}
 in function  mysql:start_reconnect/2
 in call from mysql:init/1
 in call from gen_server:init_it/6
 in call from proc_lib:init_p_do_apply/3

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我正在使用此驱动程序(https://github.com/Eonblast/Emysql),并在文档中执行所有操作 - 并且一切正常。