在通过 LuaRocks 安装 MySql 数据库驱动时发生以下异常:
daxuandeMacBook-Pro:include root# luarocks install luasql-mysql
Installing https://luarocks.org/luasql-mysql-2.3.5-1.rockspec
Error: Could not find header file for MYSQL
No file mysql.h in /usr/local/include
No file mysql.h in /usr/include
No file mysql.h in /include
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 的安装路径,只要在安装明令后面指定下 MySQL (我的路径:/usr/local/mysql )的安装路径即可:
luarocks install luasql-mysql MYSQL_DIR=/usr/local/mysql