Categories
Technology - Tips

#1045 – Access denied for user ‘root’@’localhost’ (using password: NO)

#1045 – Access denied for user ‘root’@’localhost’ (using password: NO)

Hi friends, recently i have installed MySQL on my laptop and all my website hosted on wamp are not working with error: Error establishing a database connection. I tried to connect phpmyadmin but result with another error: #1045 – Access denied for user ‘root’@’localhost’ (using password: NO) or (1045-access-denied-for-user-root-localhost-using-password-no). I looked on error and got to know that this error comes due to a password set by me on MySQL and on phpmyadmin config file ‘AllowNoPassword’ is set to true. To overcome this issue you have to modify your phpmyadmin config file.

1045 - Access denied for user  root@localhost using password NO

In previous post we have learnt MySQL to SQL Server Data Migration Through SSISERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and ApplicationHow to Install MySQL in Windows 7.

File Location: C:\wamp\apps\phpmyadmin3.5.1

1. Then open config.inc.php in your text editor.
2. Now find $cfg[‘Servers’][$i][‘password’] = ”; and change it with $cfg[‘Servers’][$i][‘password’] = ‘root’; (put root password here).
3. Now find $cfg[‘Servers’][$i][‘AllowNoPassword’] = true; and replace it by $cfg[‘Servers’][$i][‘AllowNoPassword’] = false;.
4. Save file. Now restart the wampserver. To do this left-click the wamp icon in the windows taskbar (Notification one), a box will pop up then just click on Restart all Services.

Code:

$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
$cfg['Servers'][$i]['AllowNoPassword'] = false;