mysqli_sql_exception: Access denied for user ‘root’@’localhost’ (using password: NO)

I facing this issue for couple of days. Iam working on a php web development project and iam using wamp3.3.5 . When I first encountered this situation I solved it by changing the port, But after couple of days I was met with the same error. This time I uninstalled the wamp server and installed it aggain. It worked for a single day, then the same error. Iam realy scared. I have some important files in there. Also please note that i don’t have any password since iam trying to access using root.

the steps i followed for changing port

  • in my.ini wrote skip-grant-tables after [mysqld]

-change all “port=number” present in my.ini to 3307.

  • changed $cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’; to $cfg[‘Servers’][$i][‘host’] = ‘localhost:3307′; in config.inc.php

restarted the wamp server and it worked perfectly the first time. after installing the second time i tried to access mysql cli from the wamp tray menu. It worked. But on entering the same creds to phpMyAdmin this error popped up. So i followed the above given steps. Now I can open phpMyadmin But i the database which i was working in can no longer be seen.(it vanished). then i tried it through mysql cli. Still its missing.

Also this error is present in the Apache error log

Warning


The three 'port=number' directives in the MySQL my.ini file:
[client], [wampmysqld64], [mysqld]
do not have the port number defined in wampmanager.conf: mysqlPortUsed

Press ENTER to continue