From: Date: May 23 2007 2:42pm Subject: bk commit into 5.1 tree (df:1.2526) BUG#27671 List-Archive: http://lists.mysql.com/commits/27214 X-Bug: 27671 Message-Id: <200705231246.l4NCkmp7026188@mail.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of df. When df does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-05-23 14:42:03+02:00, df@stripped +1 -0 BUG#27671 mysql_secure_installation with port and socket options scripts/mysql_secure_installation.sh@stripped, 2007-05-23 14:42:01+02:00, df@stripped +55 -30 Use an existing configuration file if supplied on command line. This configuration file will have to include the part that is otherwise written by the script, i.e. a "[mysql]" section with user=root and pass=... entries. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: df # Host: pippilotta.erinye.com # Root: /shared/home/df/mysql/build/mysql-5.1-build-work-27671 --- 1.5/scripts/mysql_secure_installation.sh 2007-01-01 05:31:20 +01:00 +++ 1.6/scripts/mysql_secure_installation.sh 2007-05-23 14:42:01 +02:00 @@ -15,9 +15,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +existingconfig="$1" config=".my.cnf.$$" command=".mysql.$$" +if [ "x$existingconfig" != "x" -a -f "$existingconfig" ] ; then + config=$existingconfig +fi + trap "interrupt" 2 rootpass="" @@ -175,7 +180,11 @@ cleanup() { echo "Cleaning up..." - rm -f $config $command + + if [ "x$existingconfig" == "x" ] ; then + rm -f $config + fi + rm -f $command } @@ -193,43 +202,59 @@ echo echo -echo "In order to log into MySQL to secure it, we'll need the current" -echo "password for the root user. If you've just installed MySQL, and" -echo "you haven't set the root password yet, the password will be blank," -echo "so you should just press enter here." -echo +if [ "x$existingconfig" != "x" ] ; then + + echo "NOTE: You provided an existing client configuration file!" + echo " This triggers an assumption that you know what you're doing!" + echo + echo + echo "In order to log into MySQL to secure it, we'll need the current" + echo "password for the root user. The file" + echo " $existingconfig" + echo "must include this password!" + echo + echo "You will not be able to change the root password with this script." + echo "If you have not set a root password, please do so manually." + echo -get_root_password +else + echo "In order to log into MySQL to secure it, we'll need the current" + echo "password for the root user. If you've just installed MySQL, and" + echo "you haven't set the root password yet, the password will be blank," + echo "so you should just press enter here." + echo -# -# Set the root password -# + get_root_password -echo "Setting the root password ensures that nobody can log into the MySQL" -echo "root user without the proper authorisation." -echo + # + # Set the root password + # -if [ $hadpass -eq 0 ]; then - echo $echo_n "Set root password? [Y/n] $echo_c" -else - echo "You already have a root password set, so you can safely answer 'n'." + echo "Setting the root password ensures that nobody can log into the MySQL" + echo "root user without the proper authorisation." echo - echo $echo_n "Change the root password? [Y/n] $echo_c" -fi -read reply -if [ "$reply" = "n" ]; then - echo " ... skipping." -else - status=1 - while [ $status -eq 1 ]; do - set_root_password - status=$? - done -fi -echo + if [ $hadpass -eq 0 ]; then + echo $echo_n "Set root password? [Y/n] $echo_c" + else + echo "You already have a root password set, so you can safely answer 'n'." + echo + echo $echo_n "Change the root password? [Y/n] $echo_c" + fi + read reply + if [ "$reply" = "n" ]; then + echo " ... skipping." + else + status=1 + while [ $status -eq 1 ]; do + set_root_password + status=$? + done + fi + echo +fi # # Remove anonymous users