Joomla normally use mysql as db backend, Arduino yun Joomla SQL communications means yun to mysql communications.
- Create test db at mysql server for test purpose.
mysql> CREATE DATABASE books;
mysql> USE books;
mysql> CREATE TABLE authors (id INT, name VARCHAR(20), email VARCHAR(20));
mysql> SHOW TABLES;
mysql> INSERT INTO authors (id,name,email) VALUES(1,"Vivek","xuz@abc.com");
- Grant access right for remote client. It might need modify my.cnf.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
- Use Lua to insert data
opkg update
opkg install luasql-mysql
nano mysql.lua
#!/usr/bin/lua
require "luasql.mysql"
env = assert (luasql.mysql())
con = assert (env:connect('books', 'root', 'password', '192.168.0.20'))
res = assert (con:execute("INSERT INTO authors (id,name,email) VALUES(2,'lua','lua@gmail.com')"))