104

PHPMyAdmin is giving me a message saying that the user (root) does not have a password.

So, how can I create one?

Daniel Montenegro
  • 1,491
  • 2
  • 15
  • 15
  • root user for mysql? or server root? phpmyadmin wouldnt need server root. why would it? you need to look into mysql user account and set that to phpmyadmin – DarthVader Sep 01 '12 at 02:31

12 Answers12

161

Open phpMyAdmin and select the SQL tab. Then type this command:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_root_password');

Also change to this line in config.inc.php:

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

To make phpMyAdmin prompts for your MySQL username and password.

Leandro Bardelli
  • 10,561
  • 15
  • 79
  • 116
flowfree
  • 16,356
  • 12
  • 52
  • 76
  • 5
    This code simply denied me access to phpmyadmin. Can't access it right now. – Daniel Montenegro Sep 01 '12 at 03:13
  • 1
    I had to change this line also $cfg['Servers'][$i]['password'] = 'your_root_password'; – Malintha Feb 07 '15 at 05:23
  • 2
    @malintha you don't need to store your password in that config file. If some one can read your `config.inc.php` file, then they can use it easily.. – CJ Ramki Jun 27 '15 at 10:02
  • This is correct. More simply to access PhpMyAdmin with MySQL server's root password, as stated in this reply, modify `$cfg['Servers'][$i]['auth_type']` to `= 'cookie` and `$cfg['Servers'][$i]['password'] = '';` , this will accept the MySQL' root password – Robert Nov 30 '19 at 15:47
  • quotes are required, took the liberty to fix it. If you think if wrong please correct them and Ill glad to put the correction in comment. Sorry and thanks for your answer, very helpful – Leandro Bardelli Aug 28 '20 at 13:50
52

To create root password in PHPMyAdmin in UI easy way, you can follow simple steps below:

  • Access phpMyAdmin with root account (no password) -> User accounts.

enter image description here

Click on root > Edit privileges

enter image description here

Then click on Change password

enter image description here

Enter your desired password -> Go

enter image description here

Logout and log-in again with new password

SonDang
  • 1,468
  • 1
  • 15
  • 21
  • 8
    Not sure why everyone else is making it more complicated. This works perfectly, is simple and answers the OP's question. – MrrMan Jun 23 '20 at 21:39
  • if you had your root account without a pwd then do not forget to add to your `config.inc.php`: `$cfg['Servers'][$i]['auth_type'] = 'cookie';` or update `config.inc.php` cause otherwise you will get auth error on entering the admin – Serhii Povísenko Oct 03 '20 at 11:32
  • I get `#1819 - Your password does not satisfy the current policy requirements` even though I have a very strong 128 bit password with a-Z 0-9 and special chars. It also says "extremly weak" – Black Jun 09 '22 at 09:23
30

Well, I believe that I've solved the password configuration 'issue' - WampServer 2.2 - Windows 7.

The three steps that I did:

  1. In the MySQL console set a new password. To make that: mysqladmin -u root password 'your_password'

  2. In phpMyAdmin click in users and set the same password to the user root.

  3. Finally, set your new password in the config.inc.php. Don't change anything else in this file.

This worked for me. Good luck!

Daniel

Kick Buttowski
  • 6,709
  • 13
  • 37
  • 58
Daniel Montenegro
  • 1,491
  • 2
  • 15
  • 15
8

PHPMyAdmin is telling you that your MySQL service is missing a root password. You can change it by accessing the MySQL command line interface. mysqladmin -u root password newpass

http://www.howtoforge.com/setting-changing-resetting-mysql-root-passwords

ThoKra
  • 2,959
  • 2
  • 27
  • 38
  • well if he never created one it s even easier than resetting. – DarthVader Sep 01 '12 at 02:34
  • Thanks a lot! But how can I insert that command in MySQL server? I mean, I've installed phpMyAdmin and Workbench too. Sorry if this is too "newbie question"... – Daniel Montenegro Sep 01 '12 at 02:56
  • Is the MySQL server running on your local machine? If so open the terminal or on windows run `cmd` and type it in there. After that you might need to reconfigure the PHPMyAdmin installation. – ThoKra Sep 01 '12 at 02:58
8
  1. Go to phpmyadmin

  2. Open user account section:

    open user account section

  3. Use EDIT Privileges

  4. Change password and username

    change password and user name

  5. Add privileges for database

Community
  • 1
  • 1
Bhavesh Tank
  • 81
  • 1
  • 3
7

Here the simple step that you can easily set phpMyAdmin Password.

  1. Goto C:\xampp\phpMyAdmin and find config.inc.php file
  2. Open config.inc.php file in Text editor like Notepad++.
  3. Find the line $cfg['Servers'][$a]['auth_type'] = 'config'; in config.inc.php file.
  4. Change the word $cfg['Servers'][$a]['auth_type'] = 'config'; to $cfg['Servers'][$a]['auth_type'] = 'cookie'; in config.inc.php file and Save the changes.
  5. Now open browser and type localhost/phpmyadmin. Enter username is root. password is null means empty. you don't type anything leave blank and press GO button.
  6. Now you can see change password link. please click that link.
  7. Set your phpMyAdmin password and retype again and press GO button.
Eje
  • 354
  • 4
  • 8
AVS
  • 71
  • 1
  • 3
6

On linux (debian 9) after resetting the mysql(Maria DB) root password, you just have to edit the phpmyadmin db config file located at /etc/phpmyadmin/config-db.php

gedit /etc/phpmyadmin/config-db.php (as root)

Community
  • 1
  • 1
ramesu
  • 67
  • 1
  • 3
5
  • Go tohttp://localhost/security/index.php
  • Select language, it redirects to http://localhost/security/xamppsecurity.php
  • You will find an option to change the password here
rinuthomaz
  • 1,393
  • 2
  • 23
  • 38
3

I only had to change one line of the file config.inc.php located in C:\wamp\apps\phpmyadmin4.1.14.

Put the right password here ...

$cfg['Servers'][$i]['password'] = 'Put_Password_Here';
hoggar
  • 3,699
  • 5
  • 31
  • 41
1

I just faced the mysql user password problem - ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO) - when I tried to do a do-release-upgrade on my operational system. So I corrected it in 2 steps.

Firstly, as I did not had access on phpmyadmin, so I followed the "Recover MySQL root password" step on the tutorial mensioned by ThoKra: https://www.howtoforge.com/setting-changing-resetting-mysql-root-passwords

Secondly, with one of the users that I know the password, I made some password changes to the others users through phpmyadmin itself according to SonDang's information.

Alexandre Ribeiro
  • 1,384
  • 1
  • 13
  • 19
1

If you tried mysqladmin -u root password 'your_password' and MySQL says denied access, you need to change the my.ini so that the value password is blank. then try mysqladmin -u root password 'your_password' again. It should change your password and open my.ini again and change the value password to the previous one.

-1

I believe the command you are looking for is passwd

Doboy
  • 10,411
  • 11
  • 40
  • 48