PHP is not connected to MySQL, but Nvicat can

Source: Internet
Author: User
PHP is not connected to MySQL, but Nvicat can.
$db =mysql_connect ("124.172.118.122", "Dbcms_f", "123456");
if (! $db)
{
Die ('
Connection error: '. Mysql_error ());
}
$sqlname = "Dbcmxs";//the name of the database
mysql_select_db ($sqlname, $db) or Die ("Link Error!!"); /Connect to Database
Session_Start ();
mysql_query ("SET NAMES ' UTF8 '", $db);//language format for defining data interaction

The error message is

Warning:mysql_connect () [Function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:553) in D:\workspace\ Php\fww\phpcms\inc\conn.php on line 2

Warning:mysql_connect () [Function.mysql-connect]: OK packet 1 bytes shorter than expected in D:\WORKSPACE\PHP\FWW\PHPCMS \inc\conn.php on line 2

Warning:mysql_connect () [Function.mysql-connect]: Mysqlnd cannot connect to MySQL 4.1+ using the old insecure authenticat Ion. Administration tool to reset your password with the command SET password = password (' Your_existing_password ' ). This would store a new, and more secure, the hash value in Mysql.user. If This user was used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from Your my.cnf file in D:\workspace\php\fww\phpcms\inc\conn.php on line 2

Connection error: Mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Administration tool to reset your password with the command SET password = password (' Your_existing_password ' ). This would store a new, and more secure, the hash value in Mysql.user. If This user was used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from Your my.cnf file

The following is my remote MySQL information
Server version: 5.5.20
Protocol version:10
Server: Localhost via UNIX socket
User: * * * *) [email protected]
MySQL Character Set: cp1252 West European (latin1)

To create a new database:
No permissions


MySQL PHP Database Server


------Solution--------------------
Warning: mysql_connect () [data in function.mysql connection]:d ended prematurely (mysqlnd_wireprotocol.c:553): \ workspace \ php\ INC \ conn.php\ fww\ phpcms on-line 2

Warning: mysql_connect () [Connection]:ok package 1 bytes less than expected in D:\ workspace \ php\ fww\ phpcms\ INC \ Conn.php2 Line

Warning: mysql_connect () [function.mysql connected mysqlnd cannot connect to mysql4.1+ using the old insecure authentication. Please use the Admin tool to reset your password command set PASSWORD = password (' Your_existing_password '). This will store a new, more secure, hash value in Mysql.user. If this user is using a different script to perform PHP5.2 or earlier, you may need to remove the old password flag line Line 2 from the my.cnf file under D:\ workspace, \ php\ Fww's \ phpcms\ inc\ conn.php

The MYSQLND connection error cannot be connected to the mysql4.1+ using the old insecure authentication. Please use the Admin tool to reset your password command set PASSWORD = password (' Your_existing_password '). This will store a new, more secure, hash value in Mysql.user. If this user executes a PHP5.2 or earlier version in another script, you may need to remove the old password flag from your my.cnf file

is your PHP version too low, or is the MySQL version too high
------Solution--------------------
According to the error message, it should be PHP with the MySQL client version is too low
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.