Search code examples
mysqlphpmyadmineasyphp

PHPMyAdmin can no longer connect to a MySQL when outside of localhost


I have a MySQL server that I manage with a phpMyAdmin. When they are both in localhost, that is, when the MySQL conf file reads:

bind-address = 127.0.0.1

And the phpMyAdmin conf file reads:

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

... then it work just fine. However, my goal is to be able to access the database from the local network, so I changed the MySQL settings to:

bind-address = 192.168.56.1

(my local address), and added a new server listing in the phpMyAdmin conf file:

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '192.168.56.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

But when I try to connect to that server, I get this error:

#1045 - Access denied for user 'root'@'Tim-N550J' (using password: NO) 

What am I missing?


Solution

  • you need to enable external connections in 192.168.56.1 from 'root'@'Tim-N550J'! like this

    CREATE USER 'root'@'Tim-N550J' IDENTIFIED BY 'some_pass';
    

    and after

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'Tim-N550J' WITH GRANT OPTION;