# phpMyAdmin: Access denied for user: 'pma@localhost'

## qnx

Hi! On my new Gentoo installation I ran into problem with getting phpMyAdmin running! Never seen this before! Here what happens when I go to my phpMyAdmin dir and enter root username and root's password:

```
Server localhost 

Error

MySQL said: 

Access denied for user: 'pma@localhost' (Using password: YES)
```

Of course I have mysqld running, as well as Apache2 with "-D PHP" option. What's wrong?? Any suggestions?

Cheers, 

Jacob

----------

## slartibartfasz

permissions in mysql are on a per-machine-basis perhaps there is some error/typo in the users table of mysql... check with:

```

mysql -u root -p

mysql> use mysql

mysql> select * from users;

```

if mysql refuses to let u access the shell, there is a howto on the mysql homepage on how to reset the root passwd

----------

## qnx

It acctually helped, take a look:

```
jacob@qnx jacob $ mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 9 to server version: 4.0.13-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select * from users;

ERROR 1146: Table 'mysql.users' doesn't exist

```

I thought I had set ut all necesary tables when I run mysql_install_db . So what should I do next?

Jacob

----------

## slartibartfasz

sorry - i always mangle that one - the table is 'user' not 'users' - sorry again...

----------

## slartibartfasz

 *qnx wrote:*   

> when I go to my phpMyAdmin dir and enter root username and root's password:
> 
> ```
> 
> Access denied for user: 'pma@localhost' (Using password: YES)
> ...

 

u say u connect as root - mysql says permission denied for 'pma' ??

just to be sure - u are aware that the myslq root user has nothing to do with your systems root user...

----------

## qnx

Right, now I tried with "select * from user" and it shows me the table. So I don't have denied connection for root or anything. But what is wrong with phpMyAdmin then?? Perhaps I have to create that pma user or something?! But I never had to, before...Please help me figuring this one out =)

----------

## samokk

pma is supposed to be a read-only user. make sure it's the case...

sam

----------

## qnx

I don't have any pma-user AFAIK.....

----------

## samokk

 *qnx wrote:*   

> I don't have any pma-user AFAIK.....

 

then deactivate its use :

$cfg['Servers'][$i]['controluser']   = '';

I guess the consequences are that you won't be able to use any other user than root. but ... it works for my use (I only care about root. I'll see later about pma & stuff..)

Sam

----------

## qnx

Done.

But I still get: 

```
MySQL said: 

Access denied for user: 'root@localhost' (Using password: NO)
```

Could somebody please show me yours config.php.inc ??

Thanks, 

Jacob

----------

## slartibartfasz

 *qnx wrote:*   

> Done.
> 
> But I still get: 
> 
> ```
> ...

 

mysql wont allow root to connect without passwd - very bad idea   :Shocked: 

----------

## slartibartfasz

u can add the pma user by doing something like this:

```

mysql -u root -p

mysql> use mysql;

mysql> GRANT ALL PRIVILEGES ON <database.*|*.*> TO pma@localhost IDENTIFIED BY <passwd>;

```

more on how the mysql privilege system works can be found here

----------

## qnx

 *slartibartfasz wrote:*   

>  *qnx wrote:*   Done.
> 
> But I still get: 
> 
> ```
> ...

 

So it says that I have not set password for root??!? I'm sure I have! I did 

```
mysqladmin -u root password 'myrootpassword'
```

Wasn't that enough???

----------

## qnx

 *slartibartfasz wrote:*   

> u can add the pma user by doing something like this:
> 
> ```
> 
> mysql -u root -p
> ...

 

Thanks, surely useful link. But do you know something like [url]http://cvsbook.red-bean.com/ The CVS book, but for MySQL?? Simlple, easy to understand, newbie tutorial?? Cause it feels as I have to learn something about MySQL. I start to dig it =)

----------

## slartibartfasz

 *qnx wrote:*   

> 
> 
> So it says that I have not set password for root??!? I'm sure I have! I did 
> 
> ```
> ...

 

no it just means that u did not use a password to log in - mysql tells u that u tried to log into the root account, but u made no attempt to provide a password - but as the root user has a password set u get a access denied message...

as for the book - no sorry - learned it the hard way myself - but the mysql book is not so bad - in the beginning there are a few easy examples... the rest is a little bit difficult though. in the beginning a gui might help - most of them are beta but usefull in the beginning - check out mysqlcc

btw - if u like cvs - take a look at subversion

----------

## qnx

Thanks for tips. Anyway, I still can't get phpMyAdmin to work. Could you  (or somebody) send me your config.inc.php please?? For me, it doesn't matter how I change settings on following lines, I allway get access denied, using password: no error. 

```
$cfg['Servers'][$i]['auth_type']     = 'http';      // Authentication method (config, http or cookie based)?

$cfg['Servers'][$i]['user']          = 'root';      // MySQL user

$cfg['Servers'][$i]['password']      = '';          // MySQL password (only needed
```

So please, just show me a working config.inc.php, thanks!

/Jacob

----------

## slartibartfasz

sorry i never used phpMyAdmin   :Confused:  ... and i'm too tired to install it now...

----------

## qnx

No problem. 

Perhaps someone else?

----------

## samokk

 *slartibartfasz wrote:*   

>  *qnx wrote:*   Done.
> 
> But I still get: 
> 
> ```
> ...

 

here's the relevant section of my config.php

$i++;

$cfg['Servers'][$i]['host']          = 'localhost'; // MySQL hostname

$cfg['Servers'][$i]['port']          = '';          // MySQL port - leave blank for default port

$cfg['Servers'][$i]['socket']        = '';          // Path to the socket - leave blank for default socket

$cfg['Servers'][$i]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')

$cfg['Servers'][$i]['compress']      = FALSE;       // Use compressed protocol for the MySQL connection

                                                    // (requires PHP >= 4.3.0)

$cfg['Servers'][$i]['controluser']   = '';       // MySQL control user settings

                                                    // (this user must have read-only

$cfg['Servers'][$i]['controlpass']   = ''; // access to the "mysql/user"

                                                    // and "mysql/db" tables)

$cfg['Servers'][$i]['auth_type']     = 'http';      // Authentication method (config, http or cookie based)?

$cfg['Servers'][$i]['user']          = 'root';      // MySQL user

$cfg['Servers'][$i]['password']      = '';          // MySQL password (only needed

                                                    // with 'config' auth_type)

$cfg['Servers'][$i]['only_db']       = '';          // If set to a db-name, only

what's important is controluser, auth_type, AFAIK.

Sam

----------

## Yamakasi

Thx Samokk,

Work great for me now!  :Smile: Last edited by Yamakasi on Mon Jun 16, 2003 10:49 am; edited 1 time in total

----------

## qnx

There's something seriously wrong....

```
MySQL said: 

 Access denied for user: 'root@localhost' (Using password: NO)
```

Even with samokk's configuration..... 

=(

----------

## samokk

 *qnx wrote:*   

> There's something seriously wrong....
> 
> ```
> MySQL said: 
> 
> ...

 

did your browser ask you for a basic apache authentication ?

if not, then it may be the problem...

sam

----------

## Yamakasi

 *qnx wrote:*   

> There's something seriously wrong....
> 
> ```
> MySQL said: 
> 
> ...

 

can u please post your config.inc

----------

## qnx

No, neither Konqueror, Opera nor Mozilla did. (I never used Mozilla before, so it's absolutly not about save password or something like that)

----------

## samokk

 *qnx wrote:*   

> No, neither Konqueror, Opera nor Mozilla did. (I never used Mozilla before, so it's absolutly not about save password or something like that)

 

that's weird....

the line auth="http" means to use standard http authentication to get the user/pass, or it's at least what I get/understood.

If it doesn't ask you for any pass... mmhh..

could you delete your phpmyadmin install, rm -rf the phpmyadmin directory, then re-install it from the ebuild, then cp config.php.dist config.php, then edit config.php, modify the few lines I gave you and try again

what happens ?

sam

----------

## qnx

It's impossible how stupied I've been!

Anyway, I deleted all stuff in /var/lib/mysql and reemerge mysql. 

Run the config-thing.

Then I unmerge phpmyadmin, deleted /etc/phpmyadmin/* and reemerge again. *Then* I saw that I have to run a config thing that creates a pmadb database for my and also creates that pma user!!!! (The file that makes it can be found in /etc/phpmyadmin/, it's called phpmyadmin.sql I think).

Thank you all for help, especially slartibartfasz and samokk!!! 

Cheers!

----------

## bolix

I stopped the services:

```

/etc/init.d/apache2 stop

/etc/init.d/mysql stop

```

Blew away the mysql dbs and recreated using the ebuild config:

```

rm -Rf /var/lib/mysql

ebuild /var/db/pkg/dev-db/${PF}/${PF}.ebuild config

/usr/bin/mysqladmin -u root -h host.domain password 'newpass'

```

Where ${PF} is the package version, host.domain is the fqdn or localhost and 'newpass' is the root password.

Next up, i imported the phpmyadmin sql settings:

```

mysql -u root -p < /etc/phpmyadmin/mysql-setup.sql

```

Started the services:

```

/etc/init.d/apache2 start

/etc/init.d/mysql start

```

I could then access http://localhost/phpmyadmin

----------

## stiwi

 *bolix wrote:*   

> 
> 
> ```
> 
> mysql -u root -p < /etc/phpmyadmin/mysql-setup.sql
> ...

 

only this, and it works  :Smile: 

----------

## tekknokrat

very old thread I know but the only error I made for at least 2 days   :Evil or Very Mad: 

I did not moved the configfile from config/ to main phpmyadmin dir.   :Rolling Eyes: 

no db creation, no pma user settings pure http auth with mysql root user and password set

with 

```

mysqladmin -u root password <newpassword>

```

EDIT: That was with the direct download, the package has another issue

-> https://bugs.gentoo.org/show_bug.cgi?id=169697

----------

## trossachs

I have a similar problem in that I have installed phpmyadmin and whenever I go to the web interface, the system immediately tries to log me in as root with this error:

```

MySQL said:  

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

I go into the 'setup script' and change the server to the correct one, add the phpmyadmin which I have just created but it does not let me in. I have never used this before and have only installed it as a client has asked for it. Why does it not ask for any login credentials?

Also, my new details, server etc is never saved when I click 'save.'

This is my config.inc.php file:

```

<?php

 */

$cfg['foo'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/*

 * Servers configuration

 */

$i = 0;

/*

 * First server

 */

$i++;

/* Authentication type */

$cfg['Servers'][$i]['auth_type'] = 'http';

/* Server parameters */

$cfg['Servers'][$i]['host'] = 'HWE_24.domain.co.uk';

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

$cfg['Servers'][$i]['compress'] = true;

/* Select mysqli if your server has it */

$cfg['Servers'][$i]['extension'] = 'mysql';

/* User for advanced features */

// $cfg['Servers'][$i]['controluser'] = 'pma';

// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

/* Advanced phpMyAdmin features */

// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';

// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';

// $cfg['Servers'][$i]['relation'] = 'pma_relation';

// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';

// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';

// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';

// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';

// $cfg['Servers'][$i]['history'] = 'pma_history';

// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';

/*

 * End of servers configuration

 */

/*

 * Directories for saving/loading files from server

 */

$cfg['UploadDir'] = '';

$cfg['SaveDir'] = '';
```

----------

