MySQL PHP incompatibility

后端 未结 10 1851
天涯浪人
天涯浪人 2020-11-28 07:42

I\'m running WAMP locally, but connecting to a remote MySQL database. The local version of PHP is the latest 5.3.0.

One of the remote databases, being version 5.0.45

10条回答
  •  一个人的身影
    2020-11-28 08:26

    The MySQL account you're using probably has an old 16 character long password (hash).
    You can test that with a MySQL client (like HeidiSQL, the MySQL console client or any other client) and an account that has access to the mysql.user table. If the Password field contains 16 chars it's an old password and mysqlnd cannot use it to connect to the MySQL server.
    You can set a new password for that user with

    SET PASSWORD FOR 'username'@'hostmask' = PASSWORD('thepassword')
    

    see dev_mysql_set_password

    edit:
    You should also check if the server is set to use/create old passwords by default.

    edit2:
    Please run the query

    SELECT
      Length(`Password`),
      Substring(`Password`, 1, 1)
    FROM
      `mysql`.`user`
    WHERE
      `user`='username'
    

    on the 5.0.22 server (the one that's "failing"). Replace username by the account you're using in mysql_connect().
    What does that return?

提交回复
热议问题