Your Digital Companion

Friday, June 26

Updating MySQL and phpmyadmin passwords in WAMP Server


WampServer is a popular software stack used for Web development for the Microsoft Windows operating system. Created by Romain Bourdon, it consists of the Apache web server, OpenSSL for SSL support, MySQL database and PHP programming language.

By default on installing WAMP server on a Windows machine,  user  - "root" is created with no passwords.
So  access can be made without any password in this manner:

  • Open the MySQL console in following way -

  • Press ENTER -
  • Which takes to the following view -

To solve this, first of all, password of MySQL root user needs to be updated.
  • Open the MySQL console
  • Run the following command
SET PASSWORD FOR root@localhost = PASSWORD(' <yourpassword> ');

After this, the root user for WAMP MySQL service will be updated with a password and access will require a password.
Similarly, phpnyadmin can be configured for access with a password as:
  • Navigate to WAMP installation directory, generally it is
    C:\wamp\apps\phpmyadmin4.1.14 

  • Open config.inc.php 

  • Update values
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
to

$cfg['Servers'][$i]['password'] = ' <yourpassword> ';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
After this, the access to phpmyadmin panel will be password restricted.