1

I tried connecting to a mysql server in realbasic using the following code:

dim db as MySQLCommunityServer 

db=New MySQLCommunityServer

  db.host="192.168.240.129"
  db.port=3306
  db.databaseName="test"
  db.userName="test"
  db.Password="test"

   If db.Connect() then
      txt1.Text = "Connected"
   else
     txt1.Text = "Connection failed!"+ chr(13)+db.ErrorMessage
   end if

and I get the following message connection failed!

Does anyone know how I can fix that?

Thanks

thegrinner
  • 11,546
  • 5
  • 41
  • 64
Gbolahan
  • 420
  • 2
  • 8
  • 18

3 Answers3

1

I just ran into this. In my case it was due to MySql Server not running on the server.

1

Try adding this:

db.databaseName="root" 
db.userName="test" 
db.Password=""
thegrinner
  • 11,546
  • 5
  • 41
  • 64
1

Check the db.Error and if true, check the db.ErrorMessage as it will give you more information as to why it failed.

If I had to guess, I'd say that the user test doesn't have permission from your IP address. But the error message will give you the reason why it couldn't connect.

BKeeney Software
  • 1,299
  • 6
  • 8