Ubuntu – PhpMyAdmin login problem:


I use Ubuntu 12.04. Recently I have installed XAMPP 1.8.1 in my system. I set password to: XAMPP pages, MySQL/phpMyAdmin, MySQL root and FTP.

But after that when I try to login to phpMyAdmin page with username 'root' and my assigned password, it doesn't login and shows a page like:

enter image description here

Also when I click on 'CD Collection' item from the left panel of my XAMPP page it shows:

Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in /opt/lampp/htdocs/xampp/cds.php on line 64
Could not connect to database!
Is MySQL running or did you change the password?

Oh! another thing, I edited the /opt/lampp/etc/extra/httpd-xampp.conf file to:

<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Require all granted

but no success…

I am complete newbie to php, mySQL, FTP and this XAMPP. Could anyone please tell me how can I login to my phpMyAdmin page??? did I do anything wrong???

Best Answer

A confusing point for almost everyone who starts using mysql is that 'root' and 'root@localhost' are two different roles and as such could (and some would argue that they actually should) have different passwords. It is quite possible you are trying to log-in as user 'root@localhost' and you are providing the password for 'root' role.

If this is the case, you can remedy it quite easily. Log-in to the database server using the CLI tool mysql as user root like this:

mysql --user=root --password

The tool will ask for your root password (not system root but database root). Now you can modify the password of 'root'@'localhost' like this:

UPDATE mysql.user SET Password=PASSWORD('cleartext password')
  WHERE User='root' AND Host='localhost';

Now try to log-in through phpMyAdmin using the newly set password.

Related Question