×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

Ok, i worked it out. But, there are still questions. see details inside please.

The reasons for failure:
1) Actually the connect port is wrong. Should be 3306 for my case. I knew it from here:
shell>mysqladmin -h 127.0.0.1 -u root variables -p |more
Detailed explaination see "http://dev.mysql.com/doc/mysql/en/Starting_server.html"

2) My sql server is 4.1.7-nt, while my client program is pre-4.1. They use different password hashing algorithm. I changed the algorithm to pre-4.1 style.
Detailed explaination see "http://dev.mysql.com/doc/mysql/en/Old_client.html"

The question is:
I think post-4.1 has more security password hashing mechanism, which set password 41-byte hash value in user table. But to be compatible with pre-4.1 clients I shortened the passwords. Is there any better way? I didn't see it from the mysql online manual.
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / [菜鸟请教] 关于PHP中与MYSQL连接的问题
    PHP代码:
    $link = @mysql_connect("127.0.0.1:2066", "root");
    if ($link)
    {
    print ("Connected successfully");
    mysql_close($link);
    }
    else
    echo "Could not connect: " . mysql_error();

    总是出现:
    Could not connect: Can't connect to MySQL server on '127.0.0.1' (10061)
    即使我把密码写在mysql_connect()中也是出现同样错误。

    但是我在MYSQL命令行下连接数据库都没有问题。

    请问,如何解决?

    谢谢!
    • i assume the port number is correct and the server does listening on the local loopback interface. is the host linux or ms, any firewall settings?
      • Thanks. the host is my computer with winXP and IIS5.1. No firewall here. I set windows firewall off.
        • ran ur php script in command line mode? what's the result?
      • Ok, i worked it out. But, there are still questions. see details inside please.
        The reasons for failure:
        1) Actually the connect port is wrong. Should be 3306 for my case. I knew it from here:
        shell>mysqladmin -h 127.0.0.1 -u root variables -p |more
        Detailed explaination see "http://dev.mysql.com/doc/mysql/en/Starting_server.html"

        2) My sql server is 4.1.7-nt, while my client program is pre-4.1. They use different password hashing algorithm. I changed the algorithm to pre-4.1 style.
        Detailed explaination see "http://dev.mysql.com/doc/mysql/en/Old_client.html"

        The question is:
        I think post-4.1 has more security password hashing mechanism, which set password 41-byte hash value in user table. But to be compatible with pre-4.1 clients I shortened the passwords. Is there any better way? I didn't see it from the mysql online manual.