1. Use the following code to test the normal operation after installing the mysql database:
| The code is as follows: |
Copy code |
<? $ Cn = mysql_connect ("localhost", "root", "root") or die ('database Server Password Error! '); If ($ cn) { Echo 'success '; } Else { Echo 'fail '; } ?> |
2. After installing the phpcms configuration today, the connection prompt "Database Server Password Error" is displayed. This indicates that the Database connection is incorrect, but the connection to mysql in cmd is successful.
3. I thought about the hosts file I modified.
Open C: \ Windows \ System32 \ drivers \ etc \ and find the following
127.0.0.1 www.111cn.net
Then I was wondering if the above mysql_connect ("localhost", "root", "root") would not have localhost, but if it was specified in hosts, it would have connected to www.111cn.net, so I corrected it.
127.0.0.1 localhost
: 1 localhost
Save and connect to mysql. The above code is output.
Success
The problem is solved in this way. The reason is also simple because locahost is used. If you modify it, you will be connected to another station. If you do not want to modify hosts, you can change the mysql connection to 127.0.0.1.