centos 安装mysql
Centos系统下安装mysql,先下载mysql-community-release-el7-5.noarch.rpm,然后通过yum安装,安装过程一直确定【Y】即可。
cd /usr/downloads/
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
安装成功后,重启mysql,并进入mysql数据库,给root用户设置一个密码,密码为“123”。
service mysqld restart
mysql -u root -p
set password for root@localhost = password('123');
openresty连接mysql
lua-resty-mysql模块的官方文档地址: https://github.com/openresty/lua-resty-mysql
lua-resty-mysql - Lua MySQL client driver for ngx_lua based on the cosocket API
lua-resty-mysql模块是基于cosocket API 为ngx_lua提供的一个Lua MySQL客户端。它保证了100%非阻塞。
vim /usr/example/lua/test_mysql.lua,添加以下的代码:
local function cl