19

My mysql password = '' i try to login to PhpMyAdmin (on Ubuntu 10.04 lamp) and get error: Login without a password is forbidden by configuration (see AllowNoPassword) What should i do for enter to phpMyAdmin without set password? Thanks

Ben
  • 765
  • 4
  • 8
  • 17

4 Answers4

29

You can turn on the option AllowNoPassword on file /etc/phpmyadmin/config.inc.php.

Edit the file config.inc.php, search and uncomment this line:

// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

Then you can access PhpMyAdmin without password.

Netum
  • 461
  • 4
  • 5
  • This command can help (tested on Ubuntu 10.04): sed '/^ .*AllowNoPassword.*/ s/\/\///' /etc/phpmyadmin/config.inc.php > /tmp/conf.tmp && mv /tmp/conf.tmp /etc/phpmyadmin/config.inc.php – Netum May 21 '10 at 13:51
  • 3
    Thanks, I make that, after that i restart apache and mysql but i still get: Login without a password is forbidden by configuration (see AllowNoPassword) – Ben May 21 '10 at 14:07
  • I also run: sudo sed '/^ .*AllowNoPassword.*/ s/\/\///' /etc/phpmyadmin/config.inc.php > /tmp/conf.tmp && mv /tmp/conf.tmp /etc/phpmyadmin/config.inc.php but i get: mv: try to overwrite `/etc/phpmyadmin/config.inc.php', overriding mode 0644 (rw-r--r--)? y mv: cannot move `/tmp/conf.tmp' to `/etc/phpmyadmin/config.inc.php': Permission denied – Ben May 21 '10 at 14:10
  • Try to get root before run the command. Execute: sudo -s and then the sed command. Finally, ajust the permissions: chmod 640 /etc/phpmyadmin/config.inc.php && chown root:www-data /etc/phpmyadmin/config.inc.php – Netum May 21 '10 at 14:51
  • 3
    I don't believe this solution works anymore in Ubuntu 14.04. I edited `/etc/phpymyadmin/config.inc.php` to uncomment/enable that line, run `sudo /etc/init.d/apache2 restart`, refresh the website, try and login with root and no password and the `AllowNoPassword` error continues to occur. – bafromca Jan 19 '15 at 22:47
  • I can confirm this solution works in 14.04 – Ryre Jun 29 '15 at 21:34
5

Here is what I have noticed from attempting to solve this problem. what I went through:

  1. I set $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
  2. I go to phpmyadmin and login fine without password ..No problem

Then I wanted to run apache with a different user than www-data so I

  • I go to /etc/apache2/eenvvars and I edit export APACHE_RUN_USER=myuser and export APACHE_RUN_GROUP=myuser

I restart apache2 and when I try to login to phpmyadmin without password it does not let me event though, as I previously mentioned, I set $cfg['Servers'][$i]['AllowNoPassword'] = TRUE.

To resolve it

  • I go to /etc/phpmyadmin/
  • check the permission (run ls-l)
  • I notice that it is root:www-data for config-db.php and for config.inc.php
  • I run sudo chown root:myuser
  • Restart apache
  • Then go to phpmyadmin and login with passowrd...It works

If you run apache with a different other than www-data (i.e you own) and your config.inc.php and config-db.php are owned by www-data, then phpmyadmin will not

Ali
  • 151
  • 1
  • 4
  • Thanks! The file now being chowed to the www-data user was the problem I had, great help! – Gary May 24 '19 at 06:58
3

use Sudo to access the following file that mention above (etc/phpmyadmin/config.inc.php.) and also stop apcaha before editing this file with this

// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

else it will wont allow you to update it. Command for stopping apcahe

sudo /etc/init.d/apache2 stop

hope it will help it works for me

mfq
  • 131
  • 1
0

Open phpmyadmin config file

sudo nano /etc/phpmyadmin/config.inc.php

/* Uncomment the following to enable logging in to passwordless accounts,
     * after taking note of the associated security risks. */
     $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
dawud
  • 14,918
  • 3
  • 41
  • 61
Nanhe Kumar
  • 409
  • 4
  • 6