Bug 68551 - RFE: add /etc/sysconfig/mysqld for lost passwd recovery
Summary: RFE: add /etc/sysconfig/mysqld for lost passwd recovery
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: mysql (Show other bugs)
(Show other bugs)
Version: 1.0
Hardware: All Linux
Target Milestone: ---
Assignee: Patrick Macdonald
QA Contact: David Lawrence
Keywords: FutureFeature
Depends On:
TreeView+ depends on / blocked
Reported: 2002-07-11 02:30 UTC by R P Herrold
Modified: 2007-04-18 16:44 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-07-11 02:30:04 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description R P Herrold 2002-07-11 02:30:00 UTC
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"
    $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --dat
adir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking >> $err_log 2>&1
    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"


yielding (see right margin ...):

  if test -z "$args"
    $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
    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"


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.

Comment 1 Trond Eivind Glomsrxd 2002-07-11 19:47:10 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.