In the process of trying to set up my database on phpmyadmin to have a password, I was locking things (stupidly) and accidentally locked the localhost access.
I’ve tried:
- Changing the user, password, & port in MySQL config
my.ini
. - Changing the user & password in PHPMyAdmin config
config.inc.php
& changing the port from3306
->4306
.
/* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'USER'; $cfg['Servers'][$i]['password'] = 'PASS'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['Servers'][$i]['port'] = 4306; $cfg['Lang'] = '';
Note: even when changing to
$cfg['Servers'][$i]['AllowNoPassword'] = false;
it still doesn’t work.
Note #2: when changing to
$cfg['Servers'][$i]['auth_type'] = 'cookie';
I get this error on the login page.
mysql -p -u root
&mysql -p -u USER
but get this error when entering the right credentials:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- Looked at this thread but this still didn’t work for me.
- Tried
mysql stop
but get this error (based on looking at this thread):
ERROR 1045 (28000): Access denied for user 'MYNAME'@'localhost' (using password: NO)
- It seems the only thread I could find with someone who’s seemingly done the exact same thing as me is this one.
So, I’ve come the conclusion there is something I need to do in order to unlock accessing phpmyadmin via localhost, but I have no idea what. I don’t think the problem is relating to an invalid password or username but instead just localhost being "locked".
How do I unlock it?
3
Answers
I just uninstalled and re-installed xampp and that did it. Just have to re-set up my database
Try to bring down your mysql instance, followed by
then make your changes, like changing the password or the access limitation.
Example:
After that, flush the privileges and restart mysql.
I faced the same issue, and I resolved it in the following way.
I faced this issue on a XAMPP server, and I opened up the XAMPP server and restarted all of the services. Then stopped all of the services and started again.
That lock option in phpmyadmin is basically to lock users out for that particular session, which means whenever you restart, everything will reconfigure in case you locked yourself out.