Apologies if this sounds trivial but I’m attempting to connect to Google Cloud SQL using XOJO code provided in one of the examples that come with XOJO i.e. MySQLExample as shown below:
mDb = New MySQLCommunityServer
mDb.Host = "xxx.xxx.xx.xx:3306"
mDb.UserName = "root"
mDb.Password = "xxxxxxxxxxxx"
mDb.DatabaseName = "guestbook"
If mDb.Connect Then
mIsConnected = True
ConnectStatusLabel.Text = "Connected to MySQL"
mIsConnected = False
ConnectStatusLabel.Text = "Error connecting to MySQL: " + mDb.ErrorMessage
Any ideas as to why I’m unsuccessful.
Any help is appreciated.
Is it actually listening on a public port ?
Or is it maybe set up to listen only to things on Google cloud like the compute engine etc ?
That would be my first guess.
any error message from mysql plugin?
I truly appreciate the replies.
@Norman Palardy :
With regard to the port AFAIK and I’ve checked it is listening on a public port. Using the “Connect to database” option in the MySQL workbench client I’m able to connect to the database instance using the parameters I’m attempting programatically. And as for only reading another Google service I dont think its doing so as the host address is specifically for the Cloud SQL instance.
@Christian Schmitz :
No errors have been thrown when I use the MySQL workbench client/program.
@Rick Araujo :
Thanks for the links. Went through the steps in them just to confirm i was doing things correctly. The IP address I’m attempting to connect from is in the list of authorised networks. Through the MySQL workbench I also created another user and attempted to connect using this user but to no success.
Thanks for any suggestions
What exactly is coming back from:
You need to GRANT access to your new user. Something like:
GRANT ALL ON
%.* TO MyNewUser IDENTIFIED BY ‘password’
@Oliver Osswald : mDb.ErrorMessage returns Unknown MySQL server host “xxx.xxx.xx.xx:3306”. How could this be when I can access the same database using MySQL workbench.
@ Rick A : I’ve granted all user as follows:
grant all privileges on mydb.guestbook to testuser@’%’ identified by ‘*************’;
I too am facing the similar issue as above.
@Alex Monari were you able to solve the issue and connect to the Cloud SQL.
Me too am pretty confident that the Cloud SQL has been configured quite correctly.
Infact prior to Xojo, I was using Processing 3, and it has worked great.
However, I am unable to connect using XOJO.