(phpmyadmin error)Login without a password is forbidden by configuration (see AllowNoPassword) in ubuntu

1.Go to /etc/phpmyadmin/config.inc.php and open it your favorite editor. 

2.Search for below line of code 

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

code lines will be looks like :-

if (!empty($dbname)) {
 //More code here
/* Uncomment the following to enable logging in to passwordless accounts,
 * after taking note of the associated security risks. */
  // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
/* Advance to next server for rest of config */
    $i++;
}

And    uncomment the    //$cfg[‘Servers’][$i][‘AllowNoPassword’] = TRUE; (just remove “//” from start) to make login in phpmyadmin with password 

/* Uncomment the following to enable logging in to passwordless accounts,
 * after taking note of the associated security risks. */
 $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

Note :-If you are using older version of php then may be there is another same line of code so you need to uncomment also these lines like 

if (!empty($dbname)) {
  // other configuration options
  $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
  $i++;
}
// another code found here
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

3.Save your file and done try to login your phpmyadmin without password. If you still have issue try to restart your apache services by following command. For more    How to restart apache ubuntu  

sudo service apache2 restart

4.If you still facing issue you need reinstall mysql again by running following command through terminal. For more    How to install mysql?  

sudo apt-get install mysql-server mysql-common mysql-client

And run your phpmyadmin and login without password now you are done you have fixed error    Login without a password is forbidden by configuration (see AllowNoPassword) in ubuntu .

原文地址:https://www.cnblogs.com/haoliansheng/p/4890341.html