Ubuntu: How to change root password for mysql and phpmyadmin?


Ubuntu: How to change root password for mysql and phpmyadmin?

The Question: I’ve set up mysql and phpmyadmin and chose not to set a password when
installing hoping that once set up i could login with root and no password but
i get the following error from phpmyadmin:
Login without a password is forbidden by configuration (see AllowNoPassword)
I have previously moved the phpmyadmin folder to /var/www/
I have tried changing the following line
$cfg[‘Servers’][$i][‘AllowNoPassword’] = false;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true;
but still had no success, so i am wondering is there a way i can change the
root passwords for both so i can access phpmyadmin and create databases.

Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):

== This solution helped 57 people ==
You can change the mysql root password by logging in to the database directly
(mysql -h your_host -u root) then run
SET PASSWORD FOR root@localhost = PASSWORD(‘yourpassword’);
phpmyadmin should use that password so not quite sure what you mean by “for
Make sure to set the new password into phpmyadmin’s config.inc.php too, at line
$cfg[‘Servers’][$i][‘password’] = ‘yourpassword’;
Otherwise, phpmyadmin may not work, echoing
Access denied for user ‘user’@’localhost’ (using password: YES)

== This solution helped 12 people ==
I recently came across this very same issue Ubuntu 12.04. I just couldn’t seem
to login with root & no password. I set the AllowNoPassword setting to TRUE in
the config. Later I found out that I was editing the wrong config.inc.php file
to add the AllowNoPassword setting.
I believe the first is the debian local config file, which will override the
usr version.

With thanks & praise to God! With thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: | Images: & others | With thanks to user Rinzwind ( user Patrizio Bertoni ( user Jon ( user jjwdesign ( user geermc4 ( user Anwar ( user Amigo Chan ( and the Stack Exchange Network ( Trademarks are property of their respective owners. Disclaimer: All information is provided “AS IS” without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.




Please enter your comment!
Please enter your name here