简体   繁体   中英

Authentication to host '192.168.0.31' for user 'username' using method 'mysql_native_password' failed with message: Unknown database 'mysql57'

Here is the error message:

Unhandled exception. MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host '192.168.0.31' for user 'username' using method 'mysql_native_password' failed with message: Unknown database 'mysql57'
 ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Unknown database 'mysql57'
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.ReadPacket()
   at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
   at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
   at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
   at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
   at MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset)
   at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.Driver.Open()
   at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlConnection.Open()

I already tested numerous solutions but none of them worked.

The database actually exists

You can download source project Here .

The name of database is wrong. Check whether it is another name or case.

So I tried to fix the error myself but there is another one

 Authentication to host 'localhost' for user 'root' using method 'caching_sha2_password' failed with message: Unknown database 'mysql80'

Your screenshot does not show that a database named mysql57 actually exists. The error message is correct: the database name you're trying to use is wrong.

Try changing to Database = brawldatabase; in your connection string.

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