Description of Problem: -- it is not uncommon to find a customer with a lost MySQL admin level password. The recovery process is well explained in the MySQL documentation, and in secondary sources. Thinking about it, however, it is routin-izable awith the addition of a new: /etc/sysconfig/mysqld parameter file to source. (another approach would ne to add a start option /etc/rc.d/init.d/mysqld nopasswd to restart the mysqld with the '--skip-grant-tables' option =========================== 1. Uncomment the new option in the config file (of the form: # -- /etc/sysconfig/mysqld config file # # 1. Uncomment the following line to allow for a password reset # in the event of a lost mysqld admin password # # LOSTPASS="--skip-grant-tables" # # 2. Stop the mysquld, and then start it again -- the option will # bring up the server without password restrictions # # Then run: # /usr/bin/mysqladmin -u root password 'whateve-passwd' # # 3. Then re-comment the LOSTPASS line, and # # 4. Restart the mysqld server to apply the new password's protection. # 2. Take down the mysqld server by stopping it: /etc/rc.d/init.d/mysqld stop 3. Steps 3 and 4 listed above, of course ... ============================= and edit the initscript at the top to source the new file: # Source the options file . /etc/sysconfig/mysqld and then in the shell script: /usr/bin/safe_mysqld toward the bottom, add the $LOSTPASS variable to the two relevant lines: if test -z "$args" then $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --dat adir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking >> $err_log 2>&1 else eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking $args >> $e rr_log 2>&1" fi --------------------------- yielding (see right margin ...): if test -z "$args" then $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --dat adir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking $LOSTPASS >> $err_log 2>&1 else eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking $LOSTPASS $args >> $err_log 2>&1" fi ================================= Alternatively, it may be documented and optioned in the started shell script itself, but this breaks rpm -V since it is not a config file, and is not the proper course.
Password recovery is not and should not be a normal operation. In the cases you do it, just stop the server and run the mysql command from the command line.