Skip to content

Instantly share code, notes, and snippets.

@ValentinNikolaev
Last active January 24, 2021 17:55
Show Gist options
  • Select an option

  • Save ValentinNikolaev/ffaf6d168dd936667ab04d85b6075fff to your computer and use it in GitHub Desktop.

Select an option

Save ValentinNikolaev/ffaf6d168dd936667ab04d85b6075fff to your computer and use it in GitHub Desktop.

Revisions

  1. ValentinNikolaev renamed this gist Jan 24, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. ValentinNikolaev created this gist Jun 25, 2019.
    25 changes: 25 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    sudo /etc/init.d/mysql stop
    sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &


    Start the mysql client process using this command
    mysql -u root

    From the mysql prompt execute this command to be able to change any password
    FLUSH PRIVILEGES;

    Then reset/update your password
    SET PASSWORD FOR root@'localhost' = PASSWORD('password');

    If you have a mysql root account that can connect from everywhere, you should also do:
    UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';

    Alternate Method:
    USE mysql
    UPDATE user SET Password = PASSWORD('newpwd')
    WHERE Host = 'localhost' AND User = 'root';

    And if you have a root account that can access from everywhere:
    USE mysql
    UPDATE user SET Password = PASSWORD('newpwd')
    WHERE Host = '%' AND User = 'root';