[SOLVED] mysql connect to server at 'localhost' failed
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Not really please use the command I gave on the first page.
Just another thing please get into the habit of beeing as specific as possible and also follow the advices given exactly. Else you post things that are of less value that is possible and I can't help you to the fullest extend.
like I said in a previous post leave out the # in front of the localhost.
Beside that the connect will not succeded the way you are calling it. What you are doing translates to the use of the command line mysql programm:
Code:
mysql -h #localhost -u #u_name -p#password
Honestly I think you don't know what you are doing. Where did you get that code from? If from a tutorial you did not read it but just copy it.
You have to replace #localhost with the name of your host. In this case localhost. #u_name should be replaced with the name of the user you want to connect with. Use root. the same goes for the #password.
So it should be like
After this it should connect. But you'll run into trouble when selecting the database. Read up on variables in php and the difference between using ' (single quote) and " (double quote).
Now check your wp-config.php settings to ensure that you have them correctly specified. You're looking for this nead the top of the file:
Code:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'your_wordpress_database_name');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'your_password_for_the_root_account');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Now check your wp-config.php settings to ensure that you have them correctly specified. You're looking for this nead the top of the file:
Code:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'your_wordpress_database_name');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'your_password_for_the_root_account');
/** MySQL hostname */
define('DB_HOST', 'localhost');
I'm sure wp-config.php settings is correct,
all info the same since my first post , and now we know the correct hostname (localhost)
please where the error ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.