What may cause the KeyNotFoundException when trying to open a MySQL connection

前端 未结 1 1187
北恋
北恋 2021-01-28 09:14

I trying to connect my database using C# code, but getting a KeyNotFoundException when the debugger gets to MySqlConnection Open method.

I Have tried changing my connect

相关标签:
1条回答
  • 2021-01-28 09:47

    You should try removing collation-server settings in your Options tab under General settings and restart your MySQL server to resolve this issue.

    OR

    You can simply add the charset to the connection string:

    Server=127.0.0.1;Port=3306;Database=database;User ID=root;Password=123456;CharSet=utf8;
    

    OR

    If your framework is .NET, then all you need to do is to make sure that your 'MySql.Data.dll' is up to date with the corresponding version.

    0 讨论(0)
提交回复
热议问题