diff options
author | unknown <monty@mysql.com> | 2004-05-26 19:12:49 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-05-26 19:12:49 +0300 |
commit | 30bffb0213dbc5b52823b167de71dd96aff1bf16 (patch) | |
tree | 45397c78051c557e55bc9b5df93c68604da6a451 /netware/mysql_fix_privilege_tables.pl | |
parent | 1d482780b0da780a02067735cff8cd8f555236e9 (diff) | |
download | mariadb-git-30bffb0213dbc5b52823b167de71dd96aff1bf16.tar.gz |
Changed prototype of killed_ptr() to make it more portable
Applied patches for Netware
innobase/include/os0thread.h:
Applied patches for Netware
innobase/os/os0thread.c:
Applied patches for Netware
libmysql/libmysql.c:
Applied patches for Netware
libmysql/libmysql.def:
Applied patches for Netware
myisam/myisamchk.c:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
myisam/myisamdef.h:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
mysql-test/t/rpl_relayspace-slave.opt:
Applied patches for Netware
mysys/my_pthread.c:
Applied patches for Netware
mysys/my_static.h:
Portability fix
netware/BUILD/compile-linux-tools:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
netware/BUILD/mwenv:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
netware/BUILD/nwbootstrap:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
netware/my_manage.c:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
netware/mysql_fix_privilege_tables.pl:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
netware/mysql_test_run.c:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
netware/static_init_db.sql:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
scripts/make_binary_distribution.sh:
Applied patches for Netware
Changed prototype of killed_ptr() to make it more portable
sql/filesort.cc:
Changed prototype of killed_ptr() to make it more portable
sql/ha_myisam.cc:
Changed prototype of killed_ptr() to make it more portable
sql/mysqld.cc:
Fixed some typos for Netware
sql/sql_bitmap.h:
Applied patches for Netware
sql/sql_class.h:
Changed prototype of killed_ptr() to make it more portable
sql/sql_insert.cc:
safety fix
strings/my_strtoll10.c:
Added comment
Diffstat (limited to 'netware/mysql_fix_privilege_tables.pl')
-rw-r--r-- | netware/mysql_fix_privilege_tables.pl | 121 |
1 files changed, 112 insertions, 9 deletions
diff --git a/netware/mysql_fix_privilege_tables.pl b/netware/mysql_fix_privilege_tables.pl index fd5bc11dde1..c0a428eff0f 100644 --- a/netware/mysql_fix_privilege_tables.pl +++ b/netware/mysql_fix_privilege_tables.pl @@ -1,16 +1,16 @@ #----------------------------------------------------------------------------- # Copyright (C) 2002 MySQL AB -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -19,7 +19,7 @@ #----------------------------------------------------------------------------- # This notice applies to changes, created by or for Novell, Inc., # to preexisting works for which notices appear elsewhere in this file. - + # Copyright (c) 2003 Novell, Inc. All Rights Reserved. # This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #----------------------------------------------------------------------------- -use strict; +#use strict; use Mysql; print "MySQL Fix Privilege Tables Script\n\n"; @@ -63,12 +63,27 @@ my $conn = Mysql->connect("localhost", "mysql", "root", $password) || die "Unable to connect to MySQL."; print "OK, successfully used the password, moving on...\n\n"; - - + + #----------------------------------------------------------------------------- # MySQL 4.0.2 #----------------------------------------------------------------------------- +#-- Detect whether or not we had the Grant_priv column +print "Fixing privileges for old tables...\n"; +$conn->query("SET \@hadGrantPriv:=0;"); +$conn->query("SELECT \@hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';"); + +#--- Fix privileges for old tables +$conn->query("UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); +$conn->query("UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); +$conn->query("UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); + + +# Detect whether we had Show_db_priv +$conn->query("SET \@hadShowDbPriv:=0;"); +$conn->query("SELECT \@hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';"); + print "Adding new fields used by MySQL 4.0.2 to the privilege tables...\n"; print "NOTE: You can ignore any Duplicate column errors.\n"; $conn->query(" \ @@ -81,9 +96,11 @@ ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv, \ ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv, \ ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; \ ") && $conn->query(" \ -UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''; \ +UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''AND \@hadShowDbPriv = 0; \ "); +#-- The above statement converts privileges so that users have similar privileges as before + #----------------------------------------------------------------------------- # MySQL 4.0 Limitations #----------------------------------------------------------------------------- @@ -97,6 +114,22 @@ ADD max_updates int(11) unsigned NOT NULL AFTER max_questions, \ ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; \ "); +#-- Change the password column to suite the new password hashing used +#-- in 4.1.1 onward +$conn->query("ALTER TABLE user change Password Password char(41) binary not null;"); + +#-- The second alter changes ssl_type to new 4.0.2 format +#-- Adding columns needed by GRANT .. REQUIRE (openssl)" +print "Adding new fields to use in ssl authentication...\n"; + +$conn->query(" \ +ALTER TABLE user \ +ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL, \ +ADD ssl_cipher BLOB NOT NULL, \ +ADD x509_issuer BLOB NOT NULL, \ +ADD x509_subject BLOB NOT NULL; \ +"); + #----------------------------------------------------------------------------- # MySQL 4.0 DB and Host privs #----------------------------------------------------------------------------- @@ -115,6 +148,77 @@ ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \ ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \ "); +# +# Change the Table_name column to be of char(64) which was char(60) by mistake till now. +# +$conn->query("alter table tables_priv change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;"); + + +# +# Create some possible missing tables +# +print "Adding online help tables...\n"; + +$conn->query(" \ +CREATE TABLE IF NOT EXISTS help_topic ( \ +help_topic_id int unsigned not null, \ +name varchar(64) not null, \ +help_category_id smallint unsigned not null, \ +description text not null, \ +example text not null, \ +url varchar(128) not null, \ +primary key (help_topic_id), unique index (name) \ +) comment='help topics'; \ +"); + +$conn->query(" \ +CREATE TABLE IF NOT EXISTS help_category ( \ +help_category_id smallint unsigned not null, \ +name varchar(64) not null, \ +parent_category_id smallint unsigned null, \ +url varchar(128) not null, \ +primary key (help_category_id), \ +unique index (name) \ +) comment='help categories'; \ +"); + +$conn->query(" \ +CREATE TABLE IF NOT EXISTS help_relation ( \ +help_topic_id int unsigned not null references help_topic, \ +help_keyword_id int unsigned not null references help_keyword, \ +primary key (help_keyword_id, help_topic_id) \ +) comment='keyword-topic relation'; \ +"); + +$conn->query(" \ +CREATE TABLE IF NOT EXISTS help_keyword ( \ +help_keyword_id int unsigned not null, \ +name varchar(64) not null, \ +primary key (help_keyword_id), \ +unique index (name) \ +) comment='help keywords'; \ +"); + + +# +# Filling the help tables with contents. +# +print "Filling online help tables with contents...\n"; +# Generate the path for "fill_help_tables.sql" file which is in different folder. +$fill_help_table=$0; +$fill_help_table =~ s/scripts[\\\/]mysql_fix_privilege_tables.pl/support-files\\fill_help_tables.sql/; + +#read all content from the sql file which contains recordsfor help tables. +open(fileIN,$fill_help_table) or die("Cannot open $fill_help_table: $!"); +@logData = <fileIN>; +close(fileIN); +foreach $line (@logData) { +# if the line is not empty, insert a record in the table. + if( ! ($line =~ /^\s*$/) ) { + $conn->query("$line"); + } +} + #----------------------------------------------------------------------------- # done #----------------------------------------------------------------------------- @@ -122,4 +226,3 @@ ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \ print "\n\nAll done!\n\n"; print "Thanks for using MySQL!\n\n"; - |