简体   繁体   中英

How to connect to MYSQL on host with lua

I have a local MYSQL db with XAMPP and a MYSQL db on my web host, i can connect to my db with php codes on my local or website.

now i want to connect to my db with Autoplay media studio using LUA language.

I use this lua code to connect my local db and it connected normally:

MySQLConnection, err = MySQL:connect("dbname", "dbuser", "dbpass", "localhost", "3306");

but when I want to connect to mysql db on my website can't connect :

MySQLConnection, err = MySQL:connect("dbname", "dbuser", "dbpass", "mywebsite.com", "3306");

Please help my how to fix it

please try using this method: I have implemented with FreeSWITCH and it is working fine.

local  dbh = freeswitch.Dbh("odbc://test:root:"1234") 
assert(dbh:connected())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM