简体   繁体   English

使用方法“mysql_native_password”对用户“root”的主机“127.0.0.1”进行身份验证失败,并显示消息:未知数据库“xxx”

[英]Authentication to host '127.0.0.1' for user 'root' using method 'mysql_native_password' failed with message: Unknown database 'xxx'

When I am running the application I am getting the following configuration error:当我运行应用程序时,我收到以下配置错误:

Authentication to host '127.0.0.1' for user 'root' using method 'mysql_native_password' failed with message: Unknown database 'kubota1'使用方法“mysql_native_password”对用户“root”的主机“127.0.0.1”进行身份验证失败,并显示消息:未知数据库“kubota1”

Here is the connection string:这是连接字符串:

string connectionString = "datasource=127.0.0.1;port=3306;username=root;password=;database=kubota1;";
MySqlConnection conn = new MySqlConnection(connectionString);

I have already created a database:我已经创建了一个数据库:

在此处输入图像描述

Try to specify the password value in your connection string.尝试在连接字符串中指定密码值。 For now, it is missed.现在,它被错过了。

are you able to connect database directly from MySQL workbench?你能直接从 MySQL 工作台连接数据库吗? if yes, then open Visual Studio > View > Server Explorer > Connect to Database.如果是,则打开 Visual Studio > 查看 > 服务器资源管理器 > 连接到数据库。 Enter required credentials and connect.输入所需的凭据并连接。 If it is connected from Visual Studio then select database from Server Explorer >> Right Click >> Properties.如果它是从 Visual Studio 连接的,那么 select 数据库来自服务器资源管理器>>右键单击>>属性。

From there you can copy connection string and use in your code.从那里您可以复制连接字符串并在您的代码中使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用方法 'mysql_native_password' 对用户 'root' 的主机 'localhost' 进行身份验证失败并显示消息(使用密码:否) - Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message (using password: NO) 使用方法“mysql_native_password”对用户“用户名”的主机“192.168.0.31”进行身份验证失败,并显示消息:未知数据库“mysql57” - Authentication to host '192.168.0.31' for user 'username' using method 'mysql_native_password' failed with message: Unknown database 'mysql57' 使用方法“ mysql_native_password”对主机或用户进行身份验证失败 - authentication to host or user using method 'mysql_native_password' failed 如何修复“使用方法 'mysql_native_password' 为用户进行身份验证失败并显示消息:从流中读取失败。” 在.NET中 - How to fix 'Authentication to host for user using method 'mysql_native_password' failed with message: Reading from the stream has failed.' in .NET 使用方法 mysql_native_password 验证失败 - Authentication failed using method mysql_native_password 方法'mysql_native_password'失败并显示消息:用户''@'RAHUL-PC'的访问被拒绝(使用密码:是) - method 'mysql_native_password' failed with message: Access denied for user ''@'RAHUL-PC' (using password: YES) 使用方法“ mysql_native_password”失败 - using method 'mysql_native_password' failed C# - 意外的身份验证方法 mysql_native_password 异常 - C# - Unexpected authentication method mysql_native_password exception 从流读取失败 - mysql_native_password错误 - Reading from stream failed - mysql_native_password error 使用ASP.NET针对MySQL数据库进行用户/密码验证 - User/Password Verification using ASP.NET against a MySQL database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM