Find the answer to your Linux question:
Results 1 to 4 of 4
Is there ayway to reset the installation of MySql so i can start from scratch. Its running on my CentOS 5 server. I have no databases and dont use MySQL ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    11

    Forgotton MySQL Root Password


    Is there ayway to reset the installation of MySql so i can start from scratch. Its running on my CentOS 5 server.

    I have no databases and dont use MySQL for anything at the moment but need to start doing so.

    I tried 'yum remove mysql' then 'yum install mysql' but that doesnt seem to reset the passwords etc.

    Any help would be appreciated.

    Cheers.

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,488
    Firstly you will need root access to the server

    Login or su to root
    Stop the MySQL Server
    And then from the command link execute mysqld --skip-grant-tables
    You can then run mysql from the command line - execute mysql -u root (You won't be asked for a password)
    In Mysql run use mysql;
    And then UPDATE user SET password = pasword("YOUR_PASSWORD") WHERE user = 'root';
    Run exit;

    Stop the mysql server and restart it normally
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    Conkybots: Interactive plugins for your Conkys!

  3. #3
    Just Joined!
    Join Date
    Nov 2009
    Posts
    11
    Quote Originally Posted by elija View Post
    Firstly you will need root access to the server

    Login or su to root
    Stop the MySQL Server
    And then from the command link execute mysqld --skip-grant-tables
    You can then run mysql from the command line - execute mysql -u root (You won't be asked for a password)
    In Mysql run use mysql;
    And then UPDATE user SET password = pasword("YOUR_PASSWORD") WHERE user = 'root';
    Run exit;

    Stop the mysql server and restart it normally
    Sorry for being a total newb but i tried what you said;

    became root then

    #service mysqld stop

    stopped the server, then

    #mysqld --skip-grant-tables
    or
    #execute mysqld --skip-grant-tables

    brings the unknown command error

    sorry if I am just being stupid!

    Cheers.

  4. #4
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,488
    mysqld may not be in your path. Try /etc/init.d/mysqld --skip-grant-tables

    If that doesn't work you can see where mysqld is by running which mysqld
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    Conkybots: Interactive plugins for your Conkys!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •