简体   繁体   中英

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

I saw couple of other posts here with the same title, and tried to follow their solutions but no help..

I am trying to connect unity3d 5 to a online database. but I keep getting this error

MySqlException: Access denied for user 'altjenb'@'217.73.137.52' (using password: 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 settings) MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection () MySql.Data.MySqlClient.MySqlPool.GetPooledConnection () MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () UnityEngine.EventSystems.EventSystem:Update()

this is my source code in 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");
    }
    }

why do I keep getting this? I dont understand..

EDIT: after getting a tweet from the db4free, they suggested to change the port from 3306 to 3307. but still getting an error.

KeyNotFoundException: The given key was not present in the dictionary. System.Collections.Generic.Dictionary`2[System.String,MySql.Data.MySqlClient.CharacterSet].get_Item (System.String key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)

try to change from mysql8.db4free.net to db4free.net and the port 3306. same user details. it should work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM