Apple MacBook Pro (Retina) connecting to a MySQL database

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
garyb
Posts: 5
Joined: Wed Feb 12, 2014 3:53 pm

Apple MacBook Pro (Retina) connecting to a MySQL database

Post by garyb » Tue Sep 09, 2014 3:08 pm

Hi guys I have moved off PC and onto Apple.

I have MySql and Navicat for MySQL on my Mac. I can open up my database with MySql with no problem.

I have taken the code off my PC and onto my MAC and cannot connect to my database through my local port. The error i get is:

"Unable to connect to database: Can't connect to local MySql server through socket '3306' (2)"

What should I change?

-- set up the connection parameters - edit these to suit your database
put "localhost" into tDatabaseAddress
put "plascondropanalysisdb" into tDatabaseName
put "root" into tDatabaseUser
put "" into tDatabasePassword
put "localhost" into tDatabaseAddress
put "plascondropanalysisdb" into tDatabaseName


-- connect to the database
put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword,False,3306, 0, True) into tResult

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Apple MacBook Pro (Retina) connecting to a MySQL databas

Post by Klaus » Tue Sep 09, 2014 3:25 pm

Hi Gary,

some observations reagarding "revopendatabase":
1. The dictionary tells to use "mysql" no capitals!
-> revOpenDatabase("mysql"...)

2. Are you sure that 3306 is really a SOCKET number? Maybe it's just the PORT you want to use to connect?
-> revOpenDatabase("mysql","localhost:3306",...)

So try this:
...
put "plascondropanalysisdb" into tDatabaseName
put "root" into tDatabaseUser
put "" into tDatabasePassword
put "localhost:3306" into tDatabaseAddress
put "plascondropanalysisdb" into tDatabaseName
put revOpenDatabase("mysql", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword,False,, 0, True) into tResult
...
Not sure, but at least worth a try :D


Best

Klaus

garyb
Posts: 5
Joined: Wed Feb 12, 2014 3:53 pm

Re: Apple MacBook Pro (Retina) connecting to a MySQL databas

Post by garyb » Wed Sep 10, 2014 8:23 am

Klaus, you are a star... it works... thank you

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Apple MacBook Pro (Retina) connecting to a MySQL databas

Post by Klaus » Wed Sep 10, 2014 1:29 pm

Hi Gary,
garyb wrote:Klaus, you are a star...
I know! :D

But I just had a deeper look at the dictionary entry for "revopendatabase" 8)


Best

Klaus

Post Reply