0

After reading multiple questions of users with problems like:

  • forgot password
  • installed multiple instances of MySQL
  • forgot to start MySQL
  • etc. etc

I started to consider if it is actually possible to conclude from the error page if MySQL is running at all?

enter image description here

Questions with the same type of answers:

But does the error page actually say this is a mysql server response or it couldn't connect (server isn't running for instance)

Take the following code:

<?php
//Step1
 $db = mysqli_connect('localhost','username','password','database_name')
 or die('Error connecting to MySQL server.');
?>

If one of the inputs is incorrect you will get the error:

Error connecting to MySQL server.

This could be modified into a nice looking error message (as the image above).

So does the error actually prove that MySQL is running or not?

4
  • MySQL might be running. You can check that my directly connecting to MySQL with mysql -u username -p databsename the response to this will tell u exact error. Commented Feb 2, 2017 at 4:36
  • sudo service mysql status Commented Feb 2, 2017 at 4:38
  • Yes, I know how to check if MySQL is running, but from the page itself (not using anything else), does PhpMyAdmin actually tell you if it is running or not? Commented Feb 2, 2017 at 4:41
  • Yes its running but its misconfigured Commented Feb 2, 2017 at 4:43

2 Answers 2

1

I found a video of a walkthrough on how to fix this error. In the video you can see the servers are running. I was pretty curious about this whole issue.

Link to Youtube: https://www.youtube.com/watch?v=8fK_DYvosA8

I'm assuming if that's how it worked for the video, that's how it works in general. I'm working off the idea that something can't give you an error message unless it's running.

Sign up to request clarification or add additional context in comments.

Comments

0

Sort of. phpMyAdmin generally returns the error message that it gets from MySQL, so for instance if the isn't a MySQL daemon listening on on the TCP/IP protocol, phpMyAdmin shows:

#2003 - Can't connect to MySQL server on '127.0.0.1' (111) — The server is not responding.

For an incorrect username or password, the error message is:

#1045 - Access denied for user 'root'@'localhost' (using password: YES)

"Invalid settings" usually means you have conflicting directives or incorrect information in one of your configuration statements. Without seeing your config.inc.php it's difficult to guess what's wrong here, but this also can mean something went wrong between the PHP library itself and MySQL.

The rejected connection message you posted can also have several causes.

Basically, to directly answer your question, you often can tell based on the error message returned by MySQL or the PHP library (which is the message phpMyAdmin shows). "Can't connect" means phpMyAdmin couldn't get any response from the MySQL daemon, which could have several causes but most often means MySQL isn't running. Most of the other error messages mean it's running but there was a problem connecting. Generally the error message contains some information about why.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.