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???

3 Answers 3


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.

  • Thanks for the answer. Anyway, when I run your first command, it shows: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    – rim
    Commented May 27, 2013 at 21:20
  • Try the solution described here: alexle.net/archives/149
    – hmayag
    Commented May 27, 2013 at 21:41
  • I can run mysql through terminal using the command: mysql --user=root --password But I can't login to the phpmyadmin page; it shows same problem.
    – rim
    Commented May 27, 2013 at 22:33
  • Let's try to narrow down our scope. Try typing mysql --user=root@localhost --password. If this doesn't work then you somehow mistyped the password. Reset the password as described in my answer and try again. If it DOES work, then there is something wrong with your phpMyAdmin configuration. Check the .conf files and make sure that phpMyAdmin is looking in the right place (i.e. the system database) for usernames and passwords. There's not enough room in this comment to walk you through that. Check the docs for phpMyAdmin. I remember there is a whole chapter about configuring authentication.
    – hmayag
    Commented May 27, 2013 at 23:15
  • Thank you very much for help. I did it!!! combining some others' idea including yours.
    – rim
    Commented May 28, 2013 at 18:42

Check the following articles:


How to change root password for mysql and phpmyadmin


I have, after 3 days of searching, got my phpMyAdmin working.

Step 1

Purge the old phpMyAdmin from the system with:

sudo apt-get purge phpmyadmin

You are offered the option of saving any info or deleting the whole lot.

Step 2

Download and install the whole caboodle again with

sudo apt-get install phpmyadmin

As you install you are asked for the Admin password (This is the password which you log in with)

Next you are asked for a password to access the phpMyAdmin UI.

Enter a new password here (I'll pretend that this is a123z ) Then confirm your password by entering it in the next box.

The script will end soon after

Step 3

Logging in to phpMyAdmin

The phpMyAdmin can be found at http://localhost/phpmyadmin/

Your username is: root

Your password is: a123z

(Not your log in password!) That's it, you are in and running.

  • Thanks for the answer. But when I tried to install phpmyadmin after purging it, terminal shows: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    – rim
    Commented May 27, 2013 at 21:24
  • I did it like this - purged, installed again and when asked entered password for phpmyadmin which is different from MySQL root password. Tried to log in to phpmyadmin as root with this password - not works (and works fine with MySQL root password). Tried to log in as phpmyadmin user with this password and it worked. Seems like it works just this way. Users root and phpmyadmin have their own passwords and you can't log in as root with a password from phpmyadmin. Or am I missing smth? Commented Feb 26, 2014 at 3:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .