在Ubuntu上安装luaSQL [英] Install luaSQL on Ubuntu

查看:65
本文介绍了在Ubuntu上安装luaSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL; DR::您可以跳到此处.我试图使用luarocks安装程序,但是apt-get安装程序确实没有问题.

TL;DR: You can skip to here. I was trying to use luarocks installer, but the apt-get installer did it without problems.

在Ubuntu上安装luaSQL时遇到问题.对于使用 luasql = require"luasql.mysql" 的脚本,我需要它.我遵循了可以在此处找到的官方文档: http://keplerproject.github.io/luasql/doc/us/
我尝试过的方法(以及官方文档中建议的方法):

I am experiencing issues when installing luaSQL on Ubuntu. I need it for a script that uses luasql = require "luasql.mysql". I followed the official documentation which can be found here: http://keplerproject.github.io/luasql/doc/us/
What I've tried (and what was suggested by the official documentation):

sudo luarocks install luasql-mysql

为我提供以下输出:

Error: Could not find expected file mysql.h for MYSQL -- 
you may have to install MYSQL in your system and/or pass MYSQL_DIR or 
MYSQL_INCDIR to the luarocks command. Example: luarocks install luasql-mysql
MYSQL_DIR=/usr/local

因此,我首先必须获取mysql.h文件.经过一番谷歌搜索后,我发现了​​这个:

So I first had to get the mysql.h file. After some googling I found this:

sudo apt-get update
sudo apt-get install libmysqlclient-dev 

所以我再次尝试了我的第一个命令,但是将mysql.h文件的位置作为参数:

So I tried my first command again, but with the location of the mysql.h file as parameter:

sudo luarocks install luasql-mysql MYSQL_DIR=/usr/include/mysql

它给了我与开始时一样的错误.有谁知道在Ubuntu计算机上安装luaSQL的正确说明?还是可以指出正确的方向?

And it gave me the same error as in the beginning. Does anyone know the right instructions for installing luaSQL on an Ubuntu machine? Or can point me in the right direction?

我的系统:
描述:Ubuntu 14.04.2 LTS
发行:14.04
代号:trusty

My system:
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

推荐答案

以安装LuaSQL:

apt-get install lua-sql-mysql


从lua-support的irc聊天中向用户'TsT'的积分:可以在此处找到聊天记录: https://botbot.me/freenode/lua-support/msg/50072546/

您可以使用的测试脚本:

A test script you can use:

luasql = require "luasql.mysql"

env = assert (luasql.mysql())
con = assert (env:connect("dbname","username","password","host.com"))
cur = assert (con:execute("INSERT INTO `table`(`col_int`,`col_varchar`) VALUES (9,'Hi')"))

这篇关于在Ubuntu上安装luaSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆