Deleted MySql root user accidently? Recreate root account

Deleted MySql root user accidently?

Follow the steps recreate the root user.

  1. If mysql service is already running, stop it.
  2. Open the command prompt and goto MYSQL_HOME/bin directory.
  3. 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.

About these ads
Leave a comment

1 Comment

  1. Grant

     /  November 9, 2011

    Tried 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.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: