4205 Georgi Kodinov 2012-08-29
Bug #14506073: mysql_secure_installation breaks with old_passwords=2
Fixed the mysql_secure_installation shell and perl scripts to do
separate updates of the different password types based on the value
of the mysql.user.plugin column, so they can set the old_passwords
value properly while calculating the password needed.
modified:
scripts/mysql_secure_installation.pl.in
scripts/mysql_secure_installation.sh
4204 Sergey Vojtovich 2012-08-29 [merge]
Merge.
modified:
include/my_base.h
sql/sql_tmp_table.cc
storage/myisam/mi_close.c
storage/myisam/mi_create.c
storage/myisam/mi_open.c
=== modified file 'scripts/mysql_secure_installation.pl.in'
--- a/scripts/mysql_secure_installation.pl.in 2012-07-26 16:30:38 +0000
+++ b/scripts/mysql_secure_installation.pl.in 2012-08-29 13:34:48 +0000
@@ -188,8 +188,19 @@ sub set_root_password {
}
my $esc_pass = basic_single_escape($password1);
- do_query("UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root';")
- or die "Password update failed!\n";
+
+ # do the old password
+ do_query("SET @\@old_passwords=1; UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root' and plugin = 'mysql_old_password';")
+ or die "old password update failed!\n";
+
+ # do the native password
+ do_query("SET @\@old_passwords=0; UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root' and plugin in ('', 'mysql_native_password');")
+ or die "native password update failed!\n";
+
+ # do the sha256 password
+ do_query("SET @\@old_passwords=2; UPDATE mysql.user SET authentication_string=PASSWORD('$esc_pass') WHERE User='root' and plugin = 'sha256_password';")
+ or die "sha256 password update failed!\n";
+
print "Password updated successfully!\n";
print "Reloading privilege tables..\n";
=== modified file 'scripts/mysql_secure_installation.sh'
--- a/scripts/mysql_secure_installation.sh 2012-07-26 16:30:38 +0000
+++ b/scripts/mysql_secure_installation.sh 2012-08-29 13:34:48 +0000
@@ -135,22 +135,38 @@ set_root_password() {
fi
esc_pass=`basic_single_escape "$password1"`
- do_query "UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root';"
- if [ $? -eq 0 ]; then
- echo "Password updated successfully!"
- echo "Reloading privilege tables.."
- reload_privilege_tables
- if [ $? -eq 1 ]; then
- clean_and_exit
- fi
- echo
- rootpass=$password1
- make_config
- else
- echo "Password update failed!"
+
+ # do the old password
+ do_query "SET @@old_passwords=1; UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root' and plugin = 'mysql_old_password';"
+ if [ $? -ne 0 ]; then
+ echo "old password update failed!"
clean_and_exit
fi
+ # do the native password
+ do_query "SET @@old_passwords=0; UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root' and plugin in ('', 'mysql_native_password');"
+ if [ $? -ne 0 ]; then
+ echo "native password update failed!"
+ clean_and_exit
+ fi
+
+ # do the sha256 password
+ do_query "SET @@old_passwords=2; UPDATE mysql.user SET authentication_string=PASSWORD('$esc_pass') WHERE User='root' and plugin = 'sha256_password';"
+ if [ $? -ne 0 ]; then
+ echo "sha256 password update failed!"
+ clean_and_exit
+ fi
+
+ echo "Password updated successfully!"
+ echo "Reloading privilege tables.."
+ reload_privilege_tables
+ if [ $? -eq 1 ]; then
+ clean_and_exit
+ fi
+ echo
+ rootpass=$password1
+ make_config
+
return 0
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.6 branch (Georgi.Kodinov:4204 to 4205) Bug#14506073 | Georgi Kodinov | 29 Aug |