1

我尝试使用以下代码连接到 realbasic 中的 mysql 服务器:

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

我收到以下消息 connection failed!

有谁知道我该如何解决?

谢谢

4

3 回答 3

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.

于 2011-07-15T20:29:36.980 回答
1

尝试添加这个:

db.databaseName="root" 
db.userName="test" 
db.Password=""
于 2011-07-15T06:30:57.557 回答
1

我刚碰到这个。就我而言,这是由于 MySql Server 未在服务器上运行。

于 2013-04-18T20:25:51.807 回答