views:

50

answers:

2

hello,

tryin to install phpMyAdmin on my Fedora server, but if i open it in browser, i get next error:

2002 Cannot log in to the MySQL server

file config.inc.php have next content:

<?php

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123';


/* End of servers configuration */

$cfg['blowfish_secret'] = '4c45c50fe8b283.01675296';
$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

just to add, in mysql i created user root, with password 123, so i can log in with:

mysql -h localhost -u root -p123

can you help me where is the problem?

A: 

ok, i solve it.

in configuration file, i just changed 'localhost' to '127.0.0.1', and it started to work.

tnx anw!

conny
+1  A: 

mysql -h localhost actually connects via unix socket instead of a TCP connection to 127.0.0.1. Explicitly specifying mysql -h 127.0.0.1 on the other hand does use the TCP method.

So what you are testing is a local socket connection, not a network one. Make sure phpMyAdmin uses the same method; the line

$cfg['Servers'][$i]['connect_type'] = 'tcp';

should probably read

$cfg['Servers'][$i]['connect_type'] = 'socket';

Your mysqld probably has either networking disabled or user permissions denying root/123 access from the network.

With -h localhost in your example you are actually connecting over a named socket. You can see for yourself - from the mysql client type "\s":

mysql> \s
--------------
(....)
Connection:     Localhost via UNIX socket
conny
it's possible because i chroot-ed my server. i will check that also.