Bug 68551 - RFE: add /etc/sysconfig/mysqld for lost passwd recovery
RFE: add /etc/sysconfig/mysqld for lost passwd recovery
Status: CLOSED WONTFIX
Product: Red Hat Raw Hide
Classification: Retired
Component: mysql (Show other bugs)
1.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Patrick Macdonald
David Lawrence
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-07-10 22:30 EDT by R P Herrold
Modified: 2007-04-18 12:44 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-07-10 22:30:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description R P Herrold 2002-07-10 22:30:00 EDT
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.
Comment 1 Trond Eivind Glomsrxd 2002-07-11 15:47:10 EDT
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.