Today's newly built LNMP environment, install WordPress Blog to do testing, installation to fill in the database information, has been error database connection errors, re-create the library, re-authorized users, all prompt the same error, and later authorized to use IP address, connection success, send a blog post everyone to discuss the problem:
Creating a database create databases blog;
Authorized user grant all on blog.* to [e-mail protected] identified by ' 123456 ';
The problem lies in:
1, in the browser to fill in the WordPress information, database host for localhost, can not connect, change to 127.0.0.1 can be connected;
However, the authorized user designated host as localhost, not 127.0.0.1;127.0.0.1 is not authorized at all;
2, local use of new authorized users and passwords can log into the database;
3. Re-authorize the user, specify the host as the local IP address: Grant all on blog.* to [email protected] identified by ' 123456 ';
can also be connected normally;
4, directly in the blog directory modification wp-config-sample.php to wp-config.php and modify the database name, user name, password, installation also prompts the database connection error;
Create a library, authorized users are no problem, is the connection problem, where is the problem?????
Using the traceroute test, the use of localhost connection speed is the fastest, but also the most error-prone; the Netizen recommends using localhost as the database host;
[Email protected] ~]# traceroute localhosttraceroute to localhost (127.0.0.1), Hops max, byte packets1 localhost (1 27.0.0.1) 0.056 Ms 0.019 ms 0.016 ms[[email protected] ~]# traceroute 127.0.0.1traceroute to 127.0.0.1 (127.0.0.1), hop s Max, packets1 localhost (127.0.0.1) 0.072 ms 0.019 ms 0.017 ms[[email protected] ~]# traceroute 192.168.20.5trac Eroute to 192.168.20.5 (192.168.20.5), Hops Max, byte packets1 192.168.20.5 (192.168.20.5) 0.090 Ms 0.020 ms 0.017 m S
This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://mofansheng.blog.51cto.com/8792265/1688552
Install wordpress connection MySQL database problem