不再支持旧密码认证,使用 4.1 风格的密码 [英] Authentication with old password no longer supported, use 4.1 style passwords

查看:38
本文介绍了不再支持旧密码认证,使用 4.1 风格的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站带有 hostgator,我想使用 C# windows 应用程序访问 mysql 数据库,但是当我尝试连接时收到此消息:

I have my website with hostgator and I want to access mysql database with C# windows application but when I tried to connect got this message:

"不再支持旧密码认证,使用4.1风格密码"

"Authentication with old password no longer supported, use 4.1 style password"

我已经尝试过给出的解决方案:

I have tried given solution:

SET SESSION old_passwords=0;
SET PASSWORD FOR user@host=PASSWORD('your pw here');

第一个查询成功执行,但在执行第二个查询时出现错误用户@主机拒绝访问".我不明白为什么会出现这个问题.我使用的是 MySQL-connecter-net 6.6.5.

first query executed successfully but I got the error "Access denied for user@host" when second query executed. I can't understand why there is this problem. I am using MySQL-connecter-net 6.6.5.

我成功地将我的数据库与 MySql Workbench 5.2.47 连接起来.

I successfully connect my database with MySql workbench 5.2.47.

有人能帮我做些什么吗?

Can anyone help me what I can do more?

我已经联系了我的托管站点,他们对 my.cnf 文件进行了更改以使用 4.1 样式的密码.我可以连接 mysql

I have contact my hosting site and they make changes to my.cnf file to use 4.1 style password. and i am able to connect with mysql

mysql -u <username> -p <password> -h <hostname>;

但是当我尝试使用 mySQL 连接器网络 6.6.5 连接 C# 时,我再次遇到此错误.

but when i tried to connect with C# with mySQL connecter net 6.6.5 i again got this error.

我在 Windows 8 64 位上使用带有 MySQL 连接器 6.6.5 的 Visual Studio 2012.这是我用来连接的代码

I am using Visual Studio 2012 with MySQL connector 6.6.5 on Windows 8 64 bit. this is the code i used to connect

using MySQL.Data.MySQLClient;

private void button1_Click(object sender, EventArgs e)
            {
                string connStr = String.Format("server={0};port={1};uid={2};password={3};database={4}",
                    txtserver.Text, txtPort.Text, txtUser.Text, txtPassword.Text, txtDatabase.Text);
                conn = new MySqlConnection(connStr);
                try
                {
                    conn.Open();
                    MessageBox.Show("Test Connection Succeded");
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

我不明白问题出在哪里.请帮帮我

I can't understand where the problem is. Please Help me

推荐答案

我遇到了同样的问题.在我的情况下,只需运行以下通过 Workbench 连接到我的数据库的命令:

I had the same problem. In my case just ran the command below connected on my database by the Workbench:

SET SESSION old_passwords=0;
SET PASSWORD FOR my_user=PASSWORD('my_password');

之后,我可以在 c# 代码中使用 MySql Connector 6.6.5 与常见的 mysql 连接字符串进行连接:

After that I could connnect using MySql Connector 6.6.5 in the c# code with the common mysql connection string:

"server=my_server_ip;user=my_user;database=my_db;port=3306;password=my_password;"

这篇关于不再支持旧密码认证,使用 4.1 风格的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆