I am trying to connect to a remote mysql database. i can successfully connect to a local MAMP hosted database. but in order to get around the security on my remote database, I need to connect using SSH. I am using this code:
put "earthednet.org:22" into tDatabaseAddress
put "prothero_livecodetest" into tDatabaseName
put "prothero_live" into tDatabaseUser
put "xxxx" into tDatabasePassword
put "3306" into tSocket
put revOpenDatabase("mysql", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword,true,tSocket) into tResult
--test for errors: if tResult not an integer, answer tResult
When I test for tResult, I get:
"Unable to connect to the database: host "ip68-... etc" is not allowed to connect to this MySQL server."
I can also get the error, as I mess with the variables:
"Unable to connect to the database: Lost connection to MySQL server at 'reading initial communication packet', system error: 0.
I have other applications that can connect to this database through ah SSH tunnel. However, the documentation on how to actually format the revOpenDatabase command is vague.
As I understand it, I need to access the ssh port, which is port 22, and in the tSocket variable, put my mySQL port number, which is 3306. Anyway, these are the correct port numbers and I can access the db with my other application that uses ssh tunneling, so:
thanks for any help.
Connect to mysql db using ssh
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 38
- Joined: Tue Sep 20, 2011 5:01 pm
- Contact:
Connect to mysql db using ssh
Last edited by waprothero on Wed Oct 10, 2012 12:27 am, edited 1 time in total.
Bill Prothero
-
- Posts: 38
- Joined: Tue Sep 20, 2011 5:01 pm
- Contact:
Re: Connect to mysql db using ssh
I notice that I had the port 3306 entered as a string. It doesn't work as a number either.
Bill Prothero
-
- Posts: 38
- Joined: Tue Sep 20, 2011 5:01 pm
- Contact:
Re: Connect to mysql db using ssh
Looks like I've solved the problem, at least partially, by using a php cgi to access the db on the server.
Bill Prothero