簡體   English   中英

嘗試連接到在線數據庫時,因用戶“用戶”錯誤而拒絕訪問

[英]Access denied for user 'user' error while trying to connect to online DB

我在這里看到了一些具有相同標題的其他帖子,並嘗試遵循他們的解決方案,但沒有幫助。

我正在嘗試將 unity3d 5 連接到在線數據庫。 但我不斷收到此錯誤

MySqlException: 用戶 'altjenb'@'217.73.137.52' 的訪問被拒絕(使用密碼:YES)MySql.Data.MySqlClient.MySqlStream.ReadPacket ()

MySql.Data.MySqlClient.NativeDriver.AuthenticateNew() MySql.Data.MySqlClient.NativeDriver.Authenticate() MySql.Data.MySqlClient.NativeDriver.Open() MySql.Data.MySqlClient.Driver.Open() MySql.Data.MySqlClient。 Driver.Create(MySql.Data.MySqlClient.MySqlConnectionStringBuilder 設置) MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() UnityEngine.EventSystems。事件系統:更新()

這是我在 C# 中的源代碼:

MySqlConnection connectionstring = new MySqlConnection("Server=mysql8.db4free.net; Port=3306;Database=testdb;UserId= altjenb; Password = faeefg; ");

string cmdText = "SELECT 1 FROM Login WHERE Username = awd";
using (MySqlCommand SelectCommand = new MySqlCommand(cmdText, connectionstring)) {
    MySqlDataReader myReader;
    connectionstring.Open();
    myReader = SelectCommand.ExecuteReader();
    int count = 0;

    while (myReader.Read())
    {
        count = count + 1;
    }

    if (count == 0)
    {
        Debug.LogWarning("spunon");
    }
    else {
        Debug.LogWarning("punon");
    }
    }

為什么我一直收到這個? 我不明白..

編輯:從 db4free 收到一條推文后,他們建議將端口從 3306 更改為 3307。但仍然出現錯誤。

KeyNotFoundException: 字典中不存在給定的鍵。 System.Collections.Generic.Dictionary`2[System.String,MySql.Data.MySqlClient.CharacterSet].get_Item(System.String 鍵)(在 /Users/builduser/buildslave/mono/build/mcs/class/corlib/System .Collections.Generic/Dictionary.cs:150)

嘗試從 mysql8.db4free.net 更改為 db4free.net 和端口 3306。相同的用戶詳細信息。 它應該工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM