1

I am not able to connect to my mysql (mariadb to be specific) via phpmyadmin, it seems there is some issue with my socket or port it tries to connect to.

At first, mysqld is running and I am able to connect to it on the command line and fiddle around with it.

I get two error messages on phpmyadmin login:
#2002 - No such file or directory — The server is not responding (or the local server's socket is not correctly configured).

mysqli_real_connect(): (HY000/2002): No such file or directory

I ran a script I came across while browsing stackexchange for solutions, these is the output:

Checking for mysqld process: root 1126 1 0 07:53 ? 00:00:00 /bin/sh 

/usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid --skip-networking mysql 1219 1126 0 07:53 ? 00:00:16 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --skip-networking --log-error=/var/lib/mysql/grooves.err --pid-file=/var/run/mysql/mysql.pid --socket=/var/lib/mysql/mysql.sock --port=3306 matthias 1589 1586 0 07:53 ? 00:00:17 /usr/libexec/mysqld --defaults-file=/home/matthias/.local/share/akonadi/mysql.conf --datadir=/home/matthias/.local/share/akonadi/db_data/ --socket=/tmp/akonadi-matthias.77jGRS/mysql.socket 
Failed with localhost, root, XXX
Failed with localhost:3306, root, XXX
Failed with 127.0.0.1, root, XXX
Failed with 127.0.0.1:3306, root, XXX
Failed with localhost, root, XXX
Failed with localhost:3306, root, XXX
Failed with ::1, root, XXX
Failed with ::1:3306, root, XXX

my hostname.err file tells me that mysql is listening on port 0 instead of 3306 what I would expect.

MariaDB [(none)]> status
--------------
mysql  Ver 15.1 Distrib 10.0.27-MariaDB, for Linux (x86_64) using readline 5.1

Connection id:          2
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MariaDB
Server version:         10.0.27-MariaDB MariaDB Server
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 5 hours 14 min 29 sec

Threads: 1  Questions: 4  Slow queries: 0  Opens: 0  Flush tables: 1  Open tables: 63  Queries per second avg: 0.000
--------------

MariaDB [(none)]>

Can anyone point me where I should investigate further on the issue? thanks in advance, this is driving me nuts for days :)

--1st edit! The script that lead to above output:

<?php

check_running();

$user='root'; // fill in your details
$password='XXX'; // fill in your details

$hosts=array(
  'localhost', '127.0.0.1', $_SERVER['HTTP_HOST'], $_SERVER['SERVER_ADDR']
);
foreach ($hosts as $addr) {
   try_con($addr, $user, $password);
   try_con($addr . ':3306', $user, $password);
}

function try_con($host, $user, $password)
{
 $dbh=mysql_connect($host, $user, $password);
 if ($dbh) {
     print "Connected OK with $host, $user, $password<br />\n";
 } else {
     print "Failed with $host, $user, $password<br />\n";
 }
}

function check_running()
{
   // this assumes that you are using Apache on a Unix/Linux box
   $chk=`ps -ef | grep httpd | grep -v grep`;
   if ($chk) {
      print "Checking for mysqld process: " . `ps -ef | grep mysqld | grep -v grep` . "<br />\n";
   } else {
       print "Cannot check mysqld process<br />\n";
   }
 }

?>
  • Where does this come from? matthias 1589 1586 0 07:53 ? 00:00:17 And why is it in the middle of the arguments? – Rick James Oct 3 '16 at 18:46
  • it is the ouput of the following script, I am not sure where it stems from. – Matt Oct 5 '16 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.