diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/make_binary_distribution.sh | 14 | ||||
-rw-r--r-- | scripts/mysql_create_system_tables.sh | 78 | ||||
-rw-r--r-- | scripts/mysql_fix_privilege_tables.sh | 45 | ||||
-rw-r--r-- | scripts/mysql_fix_privilege_tables.sql | 92 |
4 files changed, 182 insertions, 47 deletions
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 281ef9bd469..d79245a1aad 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -96,7 +96,7 @@ do fi done -# Non platform-specific bin dir files: +# Non platform-specific bin files: BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \ extra/resolveip$BS extra/my_print_defaults$BS \ extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \ @@ -107,18 +107,18 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \ client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \ client/mysqldump$BS client/mysqlimport$BS \ client/mysqltest$BS client/mysqlcheck$BS \ - client/mysqlbinlog$BS + client/mysqlbinlog$BS \ "; -# Platform-specific bin dir files: +# Platform-specific bin files: if [ $BASE_SYSTEM = "netware" ] ; then BIN_FILES="$BIN_FILES \ netware/mysqld_safe$BS netware/mysql_install_db$BS \ netware/init_db.sql netware/test_db.sql netware/mysql_explain_log$BS \ - netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql + netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql \ "; +# For all other platforms: else - # For all other platforms: BIN_FILES="$BIN_FILES \ client/mysqlmanagerc \ client/mysqlmanager-pwgen tools/mysqlmanager \ @@ -257,7 +257,9 @@ fi # Make safe_mysqld a symlink to mysqld_safe for backwards portability # To be removed in MySQL 4.1 -(cd $BASE/bin ; ln -s mysqld_safe safe_mysqld ) +if [ $BASE_SYSTEM != "netware" ] ; then + (cd $BASE/bin ; ln -s mysqld_safe safe_mysqld ) +fi # Clean up if we did this from a bk tree if [ -d $BASE/sql-bench/SCCS ] ; then diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index f524b322388..7a4da55f851 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -41,6 +41,7 @@ c_hk="" i_ht="" c_tzn="" c_tz="" c_tzt="" c_tztt="" c_tzls="" i_tzn="" i_tz="" i_tzt="" i_tztt="" i_tzls="" +c_p="" # Check for old tables if test ! -f $mdata/db.frm @@ -66,14 +67,16 @@ then c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," + c_d="$c_d Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL," + c_d="$c_d Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_d="$c_d PRIMARY KEY Host (Host,Db,User)," c_d="$c_d KEY User (User)" c_d="$c_d ) engine=MyISAM" c_d="$c_d CHARACTER SET utf8 COLLATE utf8_bin" c_d="$c_d comment='Database privileges';" - i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); - INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');" + i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y'); + INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y');" fi if test ! -f $mdata/host.frm @@ -97,6 +100,8 @@ then c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," + c_h="$c_h Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL," + c_h="$c_h Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_h="$c_h PRIMARY KEY Host (Host,Db)" c_h="$c_h ) engine=MyISAM" c_h="$c_h CHARACTER SET utf8 COLLATE utf8_bin" @@ -134,6 +139,8 @@ then c_u="$c_u Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_u="$c_u Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_u="$c_u Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL," + c_u="$c_u Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL," + c_u="$c_u Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL," c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL," c_u="$c_u ssl_cipher BLOB NOT NULL," c_u="$c_u x509_issuer BLOB NOT NULL," @@ -148,24 +155,24 @@ then if test "$1" = "test" then - i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); INSERT INTO user (host,user) values ('localhost',''); INSERT INTO user (host,user) values ('$hostname','');" else - i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);" + i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);" if test "$windows" = "0" then i_u="$i_u - INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); INSERT INTO user (host,user) values ('$hostname',''); INSERT INTO user (host,user) values ('localhost','');" else i_u="$i_u - INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);" + INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); + INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);" fi fi fi @@ -629,6 +636,54 @@ then fi fi +if test ! -f $mdata/proc.frm +then + c_p="$c_p CREATE TABLE proc (" + c_p="$c_p db char(64) binary DEFAULT '' NOT NULL," + c_p="$c_p name char(64) DEFAULT '' NOT NULL," + c_p="$c_p type enum('FUNCTION','PROCEDURE') NOT NULL," + c_p="$c_p specific_name char(64) DEFAULT '' NOT NULL," + c_p="$c_p language enum('SQL') DEFAULT 'SQL' NOT NULL," + c_p="$c_p sql_data_access enum('CONTAINS_SQL'," + c_p="$c_p 'NO_SQL'," + c_p="$c_p 'READS_SQL_DATA'," + c_p="$c_p 'MODIFIES_SQL_DATA'" + c_p="$c_p ) DEFAULT 'CONTAINS_SQL' NOT NULL," + c_p="$c_p is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL," + c_p="$c_p security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL," + c_p="$c_p param_list blob DEFAULT '' NOT NULL," + c_p="$c_p returns char(64) DEFAULT '' NOT NULL," + c_p="$c_p body blob DEFAULT '' NOT NULL," + c_p="$c_p definer char(77) binary DEFAULT '' NOT NULL," + c_p="$c_p created timestamp," + c_p="$c_p modified timestamp," + c_p="$c_p sql_mode set(" + c_p="$c_p 'REAL_AS_FLOAT'," + c_p="$c_p 'PIPES_AS_CONCAT'," + c_p="$c_p 'ANSI_QUOTES'," + c_p="$c_p 'IGNORE_SPACE'," + c_p="$c_p 'NOT_USED'," + c_p="$c_p 'ONLY_FULL_GROUP_BY'," + c_p="$c_p 'NO_UNSIGNED_SUBTRACTION'," + c_p="$c_p 'NO_DIR_IN_CREATE'," + c_p="$c_p 'POSTGRESQL'," + c_p="$c_p 'ORACLE'," + c_p="$c_p 'MSSQL'," + c_p="$c_p 'DB2'," + c_p="$c_p 'MAXDB'," + c_p="$c_p 'NO_KEY_OPTIONS'," + c_p="$c_p 'NO_TABLE_OPTIONS'," + c_p="$c_p 'NO_FIELD_OPTIONS'," + c_p="$c_p 'MYSQL323'," + c_p="$c_p 'MYSQL40'," + c_p="$c_p 'ANSI'," + c_p="$c_p 'NO_AUTO_VALUE_ON_ZERO'" + c_p="$c_p ) DEFAULT 0 NOT NULL," + c_p="$c_p comment char(64) binary DEFAULT '' NOT NULL," + c_p="$c_p PRIMARY KEY (db,name,type)" + c_p="$c_p ) comment='Stored Procedures';" +fi + cat << END_OF_DATA use mysql; $c_d @@ -661,5 +716,8 @@ $c_tztt $i_tztt $c_tzls $i_tzls + +$c_p + END_OF_DATA diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index c9e8e0c4dfd..89b96f2bc6e 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -7,13 +7,14 @@ password="" host="localhost" user="root" sql_only=0 -basedir="" +basedir="@prefix@" verbose=0 args="" port="" socket="" database="mysql" bindir="" +pkgdatadir="@pkgdatadir@" file=mysql_fix_privilege_tables.sql @@ -85,34 +86,23 @@ done parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables` parse_arguments PICK-ARGS-FROM-ARGV "$@" -if test -z "$basedir" +if test -z "$password" then - basedir=@prefix@ - if test -z "$bindir" - then - bindir=@bindir@ - fi - execdir=@libexecdir@ - pkgdatadir=@pkgdatadir@ -else - if test -z "$bindir" - then - bindir="$basedir/bin" - fi - if test -x "$basedir/libexec/mysqld" - then - execdir="$basedir/libexec" - elif test -x "@libexecdir@/mysqld" - then - execdir="@libexecdir@" - else - execdir="$basedir/bin" - fi + password=$old_style_password fi -if test -z "$password" +# Find where 'mysql' command is located + +if test -z "$bindir" then - password=$old_style_password + for i in @bindir@ $basedir/bin client + do + if test -f $i/mysql + then + bindir=$i + break + fi + done fi cmd="$bindir/mysql -f --user=$user --host=$host" @@ -134,7 +124,7 @@ fi # Find where first mysql_fix_privilege_tables.sql is located for i in $basedir/support-files $basedir/share $basedir/share/mysql \ - $basedir/scripts @pkgdatadir@ . ./scripts + $basedir/scripts $pkgdatadir . ./scripts do if test -f $i/$file then @@ -163,7 +153,8 @@ s_echo "This script updates all the mysql privilege tables to be usable by" s_echo "MySQL 4.0 and above." s_echo "" s_echo "This is needed if you want to use the new GRANT functions," -s_echo "CREATE AGGREGATE FUNCTION, or the more secure passwords in 4.1" +s_echo "CREATE AGGREGATE FUNCTION, stored procedures, or" +s_echo "more secure passwords in 4.1" s_echo "" if test $verbose = 1 diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index a60d987f8b5..cae6a1d07b9 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -15,7 +15,7 @@ ALTER TABLE host type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; ALTER TABLE func type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; ALTER TABLE columns_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; ALTER TABLE tables_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; -ALTER TABLE user change Password Password char(41) binary not null; +ALTER TABLE user change Password Password char(41) binary not null default ''; ALTER TABLE user add File_priv enum('N','Y') NOT NULL; CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, @@ -115,9 +115,9 @@ UPDATE user SET Show_db_priv= Select_priv, Super_priv=Process_priv, Execute_priv -- for some users. ALTER TABLE user -ADD max_questions int(11) NOT NULL AFTER x509_subject, -ADD max_updates int(11) unsigned NOT NULL AFTER max_questions, -ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; +ADD max_questions int(11) NOT NULL DEFAULT 0 AFTER x509_subject, +ADD max_updates int(11) unsigned NOT NULL DEFAULT 0 AFTER max_questions, +ADD max_connections int(11) unsigned NOT NULL DEFAULT 0 AFTER max_updates; -- @@ -146,6 +146,31 @@ alter table tables_priv comment='Table privileges'; alter table columns_priv comment='Column privileges'; # +# Detect whether we had Create_view_priv +# +SET @hadCreateViewPriv:=0; +SELECT @hadCreateViewPriv:=1 FROM user WHERE Create_view_priv LIKE '%'; + +# +# Create VIEWs privileges (v5.0) +# +ALTER TABLE db ADD Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv; +ALTER TABLE host ADD Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv; +ALTER TABLE user ADD Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_client_priv; + +# +# Show VIEWs privileges (v5.0) +# +ALTER TABLE db ADD Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_view_priv; +ALTER TABLE host ADD Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_view_priv; +ALTER TABLE user ADD Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_view_priv; + +# +# Assign create/show view privileges to people who have create provileges +# +UPDATE user SET Create_view_priv=Create_priv, Show_view_priv=Create_priv where user<>"" AND @hadCreateViewPriv = 0; + +# # Create some possible missing tables # CREATE TABLE IF NOT EXISTS help_topic ( @@ -218,3 +243,62 @@ Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) CHARACTER SET utf8 comment='Leap seconds information for time zones'; + +# +# Create proc table if it doesn't exists +# + +CREATE TABLE IF NOT EXISTS proc ( + db char(64) binary DEFAULT '' NOT NULL, + name char(64) DEFAULT '' NOT NULL, + type enum('FUNCTION','PROCEDURE') NOT NULL, + specific_name char(64) DEFAULT '' NOT NULL, + language enum('SQL') DEFAULT 'SQL' NOT NULL, + sql_data_access enum('CONTAINS_SQL', + 'NO_SQL', + 'READS_SQL_DATA', + 'MODIFIES_SQL_DATA' + ) DEFAULT 'CONTAINS_SQL' NOT NULL, + is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, + security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, + param_list blob DEFAULT '' NOT NULL, + returns char(64) DEFAULT '' NOT NULL, + body blob DEFAULT '' NOT NULL, + definer char(77) binary DEFAULT '' NOT NULL, + created timestamp, + modified timestamp, + sql_mode set( + 'REAL_AS_FLOAT', + 'PIPES_AS_CONCAT', + 'ANSI_QUOTES', + 'IGNORE_SPACE', + 'NOT_USED', + 'ONLY_FULL_GROUP_BY', + 'NO_UNSIGNED_SUBTRACTION', + 'NO_DIR_IN_CREATE', + 'POSTGRESQL', + 'ORACLE', + 'MSSQL', + 'DB2', + 'MAXDB', + 'NO_KEY_OPTIONS', + 'NO_TABLE_OPTIONS', + 'NO_FIELD_OPTIONS', + 'MYSQL323', + 'MYSQL40', + 'ANSI', + 'NO_AUTO_VALUE_ON_ZERO' + ) DEFAULT 0 NOT NULL, + comment char(64) binary DEFAULT '' NOT NULL, + PRIMARY KEY (db,name,type) +) comment='Stored Procedures'; + +# Correct the name fields to not binary, and expand sql_data_access +ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL, + MODIFY specific_name char(64) DEFAULT '' NOT NULL, + MODIFY sql_data_access + enum('CONTAINS_SQL', + 'NO_SQL', + 'READS_SQL_DATA', + 'MODIFIES_SQL_DATA' + ) DEFAULT 'CONTAINS_SQL' NOT NULL; |