开发者

connect to mysql server using realbasic

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


Try adding this:

db.databaseName="root" 
db.userName="test" 
db.Password=""


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜