Website Scripts And Cloud Tutorials

How to enable phpmyadmin authentication after fresh xampp install

Byadmin

Aug 27, 2014 ,

Last updated on October 25th, 2014 at 09:45 am

Click to rate this tutorial!
[Total: 0 Average: 0]

It is always a good practice to enable authentication for phpmyadmin after installing xampp, so that only authorized users can login.

First step is to modify the config.inc.php file under phpMyAdmin directory. Change the auth_type to ‘cookie’ and also add a password. Password can be any according to your wish. Change the AllowNoPassword to false.

Change config.inc.php

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'rewsdtr';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

Once you have changed the above settings and then try to access the phpmyadmin [http://localhost/phpmyadmin] url still you will be getting this error
#1045 Cannot log in to the MySQL server, Inorder to solve this issue follow the below steps.

First login to mysql using root username and Flush the previleges.

#mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 
Server version: 5.5.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Now set a password for the user root, The password should be same as the password that we have given for phpMyAdmin config file above.

mysql> SET PASSWORD FOR [email protected]'localhost' = PASSWORD('rewsdtr');
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> Bye
Ctrl-C -- exit!

Note that i have used same password for the phpmyadmin config file and also for mysql.

Now try the URL http://localhost/phpmyadmin. The issue will be fixed. Login with username as root and the password that you have provided in the above step.

Click to rate this tutorial!
[Total: 0 Average: 0]

Leave a Reply

Your email address will not be published.