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