[英]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.