简体   繁体   中英

Connection to MySQL server fails

I'm trying to access a database from the default Linux MySQL client, but all I get is a timeout. It's actually the database used by a WordPress website, and in the configuration file I can see that the IP address of the DB server is actually localhost (127.0.0.1). So I assume that the host name of the DB server is the same as the website's.

I am able to connect to the database with a PHP script that I wrote and uploaded to the server with this same information, and with the show variables query I was able to verify the port number (which was 3306) and specify it to the client. I can see a lot of variables but I'm not sure which one to use.

Any help?

If your Wordpress site is remote, you must connect to DB server like remote connection not local connection. If wordpress and DB server are in the same server, the configuration file to connect with DB is localhost, but if you want connect from remote host you must config your connecto with remote data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM