Connect to mysql db using ssh
Posted: Wed Oct 10, 2012 12:14 am
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.
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.