找回密码
 加入
搜索
查看: 3445|回复: 2

[AU3基础] 远程mysql数据库 10060错误

[复制链接]
发表于 2012-8-3 22:21:06 | 显示全部楼层 |阅读模式
#include "MySQL.au3"
#include <Array.au3>



__MySQL_ExtractEmbeddedDLL()
_MySQL_InitLibrary()
If @error Then Exit MsgBox(0, '', "could nit init MySQL")
Global $MysqlConn = _MySQL_Init()
Database()
_MySQL_Close($MysqlConn)
_MySQL_EndLibrary()

Func DATABASE()
        
        $connected = _MySQL_Real_Connect($MysqlConn, "ip", "用户名", "密码")
        If $connected = 0 Then
                $errno = _MySQL_errno($MysqlConn)
                MsgBox(0, "Error:", $errno & @LF & _MySQL_error($MysqlConn))
                If $errno = $CR_UNKNOWN_HOST Then MsgBox(0, "Error:", "$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST)
                _MySQL_Close($MysqlConn)
                _MySQL_EndLibrary()
                Exit
        EndIf

        _MySQL_Set_Character_Set($MysqlConn, "GBK")
        _MySQL_Real_Query($MysqlConn, "CREATE DATABASE IF NOT EXISTS test DEFAULT CHARSET gbk")
        _MySQL_Real_Query($MysqlConn, "use w87130;")

        Local $timedate = "now()"
        Local $my = "00:F0:00:FF:00:FF"
        Local $Name = "testname"
        Local $IDname = "s448920"
        Local $User = "右地震荡"
        Local $code = "11111"
        Local $alltest = "PASS"
        Local $time1 = "232"
        Local $time2 = "234"


        $sMySqlStatement = "CREATE TABLE IF NOT EXISTS test (" & _
                        "TimeDate TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," & _
                        "Name TEXT NOT NULL ," & _
                        "My TEXT NOT NULL," & _
                        "IDname TEXT NOT NULL ," & _
                        "User TEXT NOT NULL ," & _
                        "Code TEXT NOT NULL ," & _
                        "Result TEXT NOT NULL ," & _
                        "Time1 TEXT NOT NULL ," & _
                        "Time2 TEXT NOT NULL );"


        If _MySQL_Real_Query($MysqlConn, $sMySqlStatement, StringLen($sMySqlStatement) * 2) <> $MYSQL_SUCCESS Then
                ConsoleWrite("Error: " & _MySQL_errno($MysqlConn) & " " & _MySQL_error($MysqlConn) & @LF)
                Return
        EndIf

        Local $sMySqlStatement = "INSERT INTO test (TimeDate,Name,My,IDname," & _
                        "User,Code,Result,Time1,Time2) VALUES (NOW()," & _
                        "'" & $my & "'," & _
                        "'" & $Name & "'," & _
                        "'" & $IDname & "'," & _
                        "'" & $User & "'," & _
                        "'" & $code & "'," & _
                        "'" & $alltest & "'," & _
                        "'" & $time1 & "'," & _
                        "'" & $time2 & "');"

        ConsoleWrite("$sMySqlStatement " & $sMySqlStatement & @LF)
        If _MySQL_Real_Query($MysqlConn, $sMySqlStatement, StringLen($sMySqlStatement) * 2) <> $MYSQL_SUCCESS Then
                ConsoleWrite("error: " & _MySQL_errno($MysqlConn) & " " & _MySQL_error($MysqlConn) & @LF)
                MsgBox(16, "error: " & _MySQL_errno($MysqlConn), _MySQL_error($MysqlConn))
                Return
        Else
                MsgBox(64, "恭喜!", "写数据到数据库OK!")
        EndIf
EndFunc   ;==>DATABASE
以上代码本地mysql可以 购买的mysql服务器就10060了。
我搞不懂为什么了
发表于 2012-8-3 22:37:27 | 显示全部楼层
购买的虚拟主机一般不允许远程连接吧?
发表于 2012-8-6 01:58:14 | 显示全部楼层
你先用 管理程式 看看你購買的 MYSQL 允許不允許 遠程控制.....不允許 你怎麼寫都沒用的@@
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-27 16:57 , Processed in 0.083738 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表