Deleted MySql root user accidently?
Follow the steps recreate the root user.
- If mysql service is already running, stop it.
- Open the command prompt and goto MYSQL_HOME/bin directory.
- Run following commands
> mysqld --skip-grant-tables
Then start mysql console
> mysql –u=root
Then run following commands
> GRANT CREATE, DROP ON *.* TO root@localhost IDENTIFIED BY 'newpass' WITH GRANT OPTION;
> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'newpass' WITH GRANT OPTION;
Then restart the mysql service and you are done.