Resetting your MySQL Password


  1. Use ps and kill to stop your MySQL server without having the password. Running ps uxw will list the processes running on your account, including their PID or Process ID. The kill command takes PIDs as arguments, and attempts to stop the processes those PIDs refer to. Below is an example of using ps and kill to stop your MySQL processes.
    $ ps uxw  USER    PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND  netid  8977  0.0  0.0  10952  1620 ?        S    14:16   0:00 sshd: netid@pts/51  netid  8978  0.0  0.0   5348  1748 pts/51   Ss+  14:16   0:00 -psh  netid 10539  0.0  0.0   5068  1256 pts/51   R+   14:32   0:00 ps uxw  netid 18438  0.0  0.0   4488  1188 ?        S    Nov09   0:00 /bin/sh bin/mysqld_safe  netid 18463  0.0  0.0  15852  3848 ?        S    Nov09   0:00 /da23/d54/netid/mysql/bin/mysqld --basedir=/da23/d54/netid/mysql  netid 18464  0.0  0.0  15852  3848 ?        S    Nov09   0:00 /da23/d54/netid/mysql/bin/mysqld --basedir=/da23/d54/netid/mysql  netid 18465  0.0  0.0  15852  3848 ?        S    Nov09   0:00 /da23/d54/netid/mysql/bin/mysqld --basedir=/da23/d54/netid/mysql  $ kill 18438 18463 18464 18465  $ ps uxw  USER    PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND  netid  8977  0.0  0.0  10952  1620 ?        S    14:16   0:00 sshd: netid@pts/51  netid  8978  0.0  0.0   5348  1748 pts/51   Ss+  14:16   0:00 -psh  netid 10539  0.0  0.0   5068  1256 pts/51   R+   14:32   0:00 ps uxw  
    You can see in the output from the second run of ps uxw that the MySQL processes are no longer running. Your MySQL server is currently off.
  2. Start MySQL in "wide open" mode by typing the following command:
    cd ~/mysql
    bin/mysqld_safe --skip-grant-tables &
    • Anyone anywhere can log on to your MySQL server while it is in this mode, so don't leave it this way.
  3. Log in to MySQL by typing the following command:
    bin/mysql
  4. Set a new password by typing the following command:
    mysql> UPDATE mysql.user SET Password=PASSWORD('put your password here') WHERE User='root';
    mysql> EXIT
  5. Restart MySQL by typing the following commands:
    bin/mysqladmin shutdown
    bin/mysqld_safe &





Popular posts from this blog

Shrink you container size up to 95%.

alma linux: dnf Module yaml error: Unexpected key in data