如何在Erlang中安装驱动程序? (特别是MySQL-otp驱动程序)

问题描述 投票:0回答:2

documentation这个司机看起来很棒。我不知道如何安装它,以便我可以使用它。我读到某个地方,我应该使用rebar?我看了那个文档虽然它似乎有相反的问题。它说明了如何安装它,但不知道如何使用它。


更新

所以看起来在安装钢筋之后,我可以添加线条

{deps, [
    {mysql, ".*", {git, "https://github.com/mysql-otp/mysql-otp",
                   {tag, "1.3.3"}}}
]}.

到我的文件rebar.config。我不知道这是做什么的。我现在必须编译或制作此文件吗? rebar.config必须与我的项目位于同一目录中吗?对不起rebar.config的路径是~/rebar/rebar.config放置我的项目以使它成为文件层次结构中钢筋的兄弟是否正确?


更新

我用rebar文件夹运行了./rebar get-deps并得到了

Pulling mysql from {git,"https://github.com/mysql-otp/mysql-otp",
                        {tag,"1.3.3"}}
Cloning into 'mysql'...
==> mysql (get-deps)

我仍然不知道这意味着什么,当我尝试编译我的erlang文件时,我收到了结果。

c(erlangFile.erl).
{error,non_existing}
mysql erlang otp erl
2个回答
1
投票

rebar是erlang的构建工具。请通过https://github.com/rebar/rebar/wiki/Rebar-commands获取命令。获得依赖后,需要“rebar compile”来编译它。要使用光束文件,必须使用Add Path to Erlang Search Path?这些方法给出输出光束路径。然后,您就可以在代码中使用它。


0
投票

在这种情况下,请下载您的包裹

git clone https://github.com/mysql-otp/mysql-otp.git

下载名为rebar的工具

git clone git://github.com/rebar/rebar.git
cd rebar
./bootstrap

Add the following to rebar/rebar.config

{deps, [
    {mysql, ".*", {git, "https://github.com/mysql-otp/mysql-otp",
                   {tag, "1.3.3"}}}
]}.

在rebar / mysql-otp目录下运行

./rebar get-deps

然后在同一目录中运行

./rebar compile

这会将一堆.beam文件和.app文件放入ebin /目录

接下来将ebin /目录添加到您的路径中。您可以更新$ ERL_LIBS环境变量run an include command within the erlang console like

1> code:add_pathz("~/rebar/mysql-otp/ebin").

要么

1> code:add_pathz("rebar/mysql-otp/ebin")

And theres a few other ways to add it to your Erlang path.


另外,确保还安装了mysql

下面是一些与我有用的mysql安装说明的链接

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-7

No package msyql-server available

© www.soinside.com 2019 - 2024. All rights reserved.