I accidentally removed the root user from my local mysql installation. This poses a big problem as now you have lost access to this database except for existing users.
Here are the steps to follow:
1. Stop your mysql service. Stop it via you WAMP installation by left clicking the WAMP icon in the taskbar `MySQL` => `Stop Service`or in the command line. 2. Create a text file on preferably on the root of your C drive call it "init_queries.txt". 3. Edit "init_queries.txt" and add the SQL you want to run.
To recreate the root user do the following:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'myPassWord' WITH GRANT OPTION;
Enter whatever you like in the above text file as you can run any SQL in here.
4. Go to command prompt. 5. Go to mysql bin folder and run the following:
mysqld-nt.exe --init-file=c:\init_queries.txt
6. This will reset the password to `myPassWord`. 7. Connect to your mysql server again and use the user `root` and password `myPassWord`. Reset the password to one you like. Then restart your mysql like you normally would
By PHPin24 @ 2008-11-17 23:54:23
|