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.
Grant
/ November 9, 2011Tried this and no luck.
Error below
> mysql> GRANT CREATE, DROP ON *.* TO root@localhost IDENTIFIED BY ‘newpass’
> WITH GRANT OPTION;
> ERROR 1290 (HY000): The MySQL server is running with the –skip-grant-tables option > so it cannot execute this statement
Any ideas, Thanks.