Package.path require MySQL Error

Source: Internet
Author: User
Tags lua

In the file

Package.path ' /usr/local/share/lua/5.1/?. Lua;/usr/local/openresty/lualib/resty/?. LUA; ' Package.cpath ' /usr/local/lib/lua/5.1/?. So; '

Perform
Local MySQL = require "MySQL"--correct
Local MySQL = require "resty.mysql"--Error

Remove
Package.path = '/usr/local/share/lua/5.1/? Lua;/usr/local/openresty/lualib/resty/?. Lua; ' Package.cpath = '/usr/local/lib/lua/5.1/? So; '

Local MySQL = require "mysql"--error
Local MySQL = require "resty.mysql"--correct

Where does the default path of the Package.path point?

Remove Package.path, in the page to refer to a non-existent module such as require ' AA '

View Nginx error log return

No fieldPackage.preload['AA'] No file'/usr/local/openresty/lualib/aa.lua'no file'/usr/local/openresty/lualib/aa/init.lua'no file'./aa.lua'no file'/usr/local/openresty/luajit/share/luajit-2.1.0-alpha/aa.lua'no file'/usr/local/share/lua/5.1/aa.lua'no file'/usr/local/share/lua/5.1/aa/init.lua'no file'/usr/local/openresty/luajit/share/lua/5.1/aa.lua'no file'/usr/local/openresty/luajit/share/lua/5.1/aa/init.lua'no file'/usr/local/openresty/lualib/aa.so'no file'./aa.so'no file'/usr/local/lib/lua/5.1/aa.so'no file'/usr/local/openresty/luajit/lib/lua/5.1/aa.so'no file'/usr/local/lib/lua/5.1/loadall.so'

Discover /usr/local/openresty/lualib/aa.lua The default path is/usr/local/openresty/lualib then add it to the page

Package.path ' /usr/local/share/lua/5.1/?. Lua;/usr/local/openresty/lualib/resty/?. LUA; /usr/local/openresty/lualib/?. LUA; '

Package.cpath'/usr/local/lib/lua/5.1/? So; '

Perform the correct

Novice ~ ~ Don't blame

Package.path require MySQL Error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.