Open C:\xampp\mysql\bin\my.ini
(MySQL config file)
Find the line [mysqld]
and right below it add skip-grant-tables
. Example:
# The MySQL server
[mysqld]
skip-grant-tables
port= 3306
socket = "C:/xampp/mysql/mysql.sock"
basedir = "C:/xampp/mysql"
tmpdir = "C:/xampp/tmp"
[...etc...]
This should allow you to access MySQL if you don't know your password.
Stop and start MySQL from XAMPP to make this change take effect.
Next, in command line, connect to MySQL:
C:\xampp\mysql\bin\mysql.exe --user=root
Once in MySQL command line "select" the mysql
database:
USE mysql;
Then, the following command will list all your MySQL users:
SELECT * FROM user \G;
You can scan through the rows to see what the root
user's password is set to. There will be a few root
users listed, with different hosts.
To set all root
user's to have a blank password, run this command:
UPDATE user SET password = '' WHERE user = 'root';
When you're done, run exit;
to exit the MySQL command line.
Next, re-enable password checking by removing skip-grant-tables
from C:\xampp\mysql\bin\my.ini
.
Save changes, restart MySQL from XAMPP.
Finally, test you can connect to the database using username root
and password ''
(blank) via one of the following methods:
- Attempting to access phpMyAdmin (http://localhost/phpmyadmin)
- Run the debug route I provided from within one of your Laravel apps
I am using a fresh install of XAMPP on a Windows 10 machine. The install goes great but as soon as I change the password for localhost:root I am locked out of the admin section for MySQL. I was able to bypass password checking with the skip-grant-tables line, but unable to reset the password for root users - I get a message that changes are not allowed to the column. I did not have this problem on a previous machine / install and am completely unable to determine a cause for this problem. Any suggestions as to how to change the root password and still be able to use the admin functions in XAMPP?