Bug 68551 - RFE: add /etc/sysconfig/mysqld for lost passwd recovery
Summary: RFE: add /etc/sysconfig/mysqld for lost passwd recovery
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: mysql
Version: 1.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Patrick Macdonald
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
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:
Clone Of:
Environment:
Last Closed: 2002-07-11 02:30:04 UTC
Embargoed:


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"
  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 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.