luarocks錯誤 require ‘luasql.mysql' 報module 'luasql.mysql' not found:

來源:互聯網
上載者:User

標籤:for   終端   error   ade   header   nbsp   UI   span   local   

錯誤:

require ‘luasql.mysql‘
stdin:1: module ‘luasql.mysql‘ not found:
no field package.preload[‘luasql.mysql‘]
no file ‘/usr/local/share/lua/5.3/luasql/mysql.lua‘
no file ‘/usr/local/share/lua/5.3/luasql/mysql/init.lua‘
no file ‘/usr/local/lib/lua/5.3/luasql/mysql.lua‘
no file ‘/usr/local/lib/lua/5.3/luasql/mysql/init.lua‘
no file ‘./luasql/mysql.lua‘
no file ‘./luasql/mysql/init.lua‘
no file ‘/usr/local/lib/lua/5.3/luasql/mysql.so‘
no file ‘/usr/local/lib/lua/5.3/loadall.so‘
no file ‘./luasql/mysql.so‘
no file ‘/usr/local/lib/lua/5.3/luasql.so‘
no file ‘/usr/local/lib/lua/5.3/loadall.so‘
no file ‘./luasql.so‘
stack traceback:
[C]: in function ‘require‘
stdin:1: in main chunk
[C]: in ?

環境: ubuntu 已安裝lua,未安裝mysql

解決方案

一、先安裝mysql

Ubuntu上安裝MySQL非常簡單只需要幾條命令就可以完成。

1. sudo apt-get install mysql-server

2. apt-get isntall mysql-client

3.  sudo apt-get install libmysqlclient-dev

參考連結

http://www.linuxidc.com/Linux/2016-07/133128.htm

二 安裝luasql-mysql

luarocks install luasql-mysql

參考連結 http://www.runoob.com/lua/lua-database-access.html

三 安裝luasql-mysql 出錯

Error: Could not find header file for MYSQL
No file mysql.h in /usr/local/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

解決方案:

在終端執行whereis mysql 找到mysql 的include路徑

luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql 

注釋:配置自己查到的mysql.h 所在路徑

 

luarocks錯誤 require ‘luasql.mysql' 報module 'luasql.mysql' not found:

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.