put "mp04.projectsbit.org" into tDatabaseAddress'
put "runrev_test" into tDatabaseName
put "fakeuser" into tDatabaseUser
put "fakepassword" into tDatabasePassword
put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
-- check if it worked and display an error message if it didn't
-- & set the connection ID global
if tResult is a number then
put tResult into gConnectionID
answer info "Connected to the database." & cr & "Connection ID = " & gConnectionID
else
put empty into gConnectionID
answer error "Unable to connect to the database:" & cr & tResult
end if
cPanel is not LiveCode so I am not sure what you are trying to do and how you are trying to do it.
Is the code you supplied a part of a script from LiveCode server?
The database name looks a bit unlikely- is that a fake name too or does it really look like that when you use (say) phpMyAdmin?
if i remember right, you have to allow remote access to your MySQL database to be able to access your database from a desktop app.
For security reasons the access to the database is only allowed from the localhost. So if you want to allow the access from remote then add your ip or %.%.%.% (as a wildcard) in cPanel under Remote MySQL.
This should allow to connect to the database from your Livecode desktop app.
As a side note, If your app is going to be distributed to users, you should probably not hardcode your database credentials into the app itself, and instead use a "middleware" script, which can be easily done in LC or PHP.
HostM has provided a nice tutorial for how to securely connect to MySQL/MariaSQL Database from a Livecode Desktop app using a Livecode Server script on your webserver.
matthiasr wrote: Mon Sep 24, 2018 7:34 pm
HostM has provided a nice tutorial for how to securely connect to MySQL/MariaSQL Database from a Livecode Desktop app using a Livecode Server script on your webserver.
if i remember right, you have to allow remote access to your MySQL database to be able to access your database from a desktop app.
For security reasons the access to the database is only allowed from the localhost. So if you want to allow the access from remote then add your ip or %.%.%.% (as a wildcard) in cPanel under Remote MySQL.
This should allow to connect to the database from your Livecode desktop app.
Regards,
Matthias
Hello Matthias!
Thank for you replies! Just want to double check in the Remote MySQL i will need to add my current ip address? or any ip address ?
You need to add the ip address from where you want to connect to the DB.
That´s the ip address you are getting from your ISP when connecting to the internet, not your local ip address.
But for security reasons you should consider to use a php or livecode server script on your webserver to do the database communication. In this case you do not need to allow remote access. I really recommend to visit the link to the HostM tutorial.