mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Added the following new privleges:
SHOW DATABASES CREATE TEMPORARY TABLE LOCK TABLES REPLICATION SLAVE & REPLICATION CLIENT SUPER EXECUTE All scripts & documentation is updated for this change. Added better error messages for global privileges BitKeeper/deleted/.del-mysql_new_fix_privilege_tables.sh~b1664b401375eece: Delete: scripts/mysql_new_fix_privilege_tables.sh Docs/manual.texi: Updated manual for privilege changes. include/mysqld_error.h: new error messages mysql-test/install_test_db.sh: Updated to use new privileges mysql-test/r/grant_cache.result: Updated to use new privileges mysql-test/r/rpl000017.result: Updated to use new privileges mysql-test/t/rpl000017.test: Updated to use new privileges mysys/safemalloc.c: Cleanup scripts/mysql_fix_privilege_tables.sh: Updated to use new privileges scripts/mysql_install_db.sh: Updated to use new privileges sql/field.h: Cleanup sql/item_strfunc.cc: Updated to use new privileges sql/lex.h: Updated to use new privileges sql/log.cc: Updated to use new privileges sql/mysql_priv.h: Updated to use new privileges sql/mysqld.cc: Updated to use new privileges sql/repl_failsafe.cc: Updated to use new privileges sql/share/czech/errmsg.txt: new error messages sql/share/danish/errmsg.txt: new error messages sql/share/dutch/errmsg.txt: new error messages sql/share/english/errmsg.txt: new error messages sql/share/estonian/errmsg.txt: new error messages sql/share/french/errmsg.txt: new error messages sql/share/german/errmsg.txt: new error messages sql/share/greek/errmsg.txt: new error messages sql/share/hungarian/errmsg.txt: new error messages sql/share/italian/errmsg.txt: new error messages sql/share/japanese/errmsg.txt: new error messages sql/share/korean/errmsg.txt: new error messages sql/share/norwegian-ny/errmsg.txt: new error messages sql/share/norwegian/errmsg.txt: new error messages sql/share/polish/errmsg.txt: new error messages sql/share/portuguese/errmsg.txt: new error messages sql/share/romanian/errmsg.txt: new error messages sql/share/russian/errmsg.txt: new error messages sql/share/slovak/errmsg.txt: new error messages sql/share/spanish/errmsg.txt: new error messages sql/share/swedish/errmsg.txt: new error messages sql/share/ukrainian/errmsg.txt: new error messages sql/slave.cc: Portability cleanup sql/sql_acl.cc: Updated to use new privileges sql/sql_acl.h: Updated to use new privileges sql/sql_base.cc: Remove not used include file sql/sql_class.cc: Comment cleanup sql/sql_class.h: Updated to use new privileges Comment cleanups sql/sql_insert.cc: Updated to use new privileges sql/sql_lex.h: Indentation cleanup sql/sql_parse.cc: Updated to use new privileges sql/sql_repl.cc: Updated to use new privileges Comment cleanup sql/sql_show.cc: Updated to use new privileges sql/sql_yacc.yy: Updated to use new privileges Sorted some tockens for easer merge to 4.1 in the future. sql/table.h: Updated to use new privileges tests/grant.pl: Updated to use new privileges tests/grant.res: Updated to use new privileges
This commit is contained in:
@ -12,6 +12,17 @@ echo "and give the MySQL root user password as a argument!"
|
||||
root_password="$1"
|
||||
host="localhost"
|
||||
|
||||
echo "Converting all privilege tables to MyISAM format"
|
||||
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
ALTER TABLE user type=MyISAM;
|
||||
ALTER TABLE db type=MyISAM;
|
||||
ALTER TABLE host type=MyISAM;
|
||||
ALTER TABLE func type=MyISAM;
|
||||
ALTER TABLE columns_priv type=MyISAM;
|
||||
ALTER TABLE tables_priv type=MyISAM;
|
||||
END_OF_DATA
|
||||
|
||||
|
||||
# Fix old password format, add File_priv and func table
|
||||
echo ""
|
||||
echo "If your tables are already up to date or partially up to date you will"
|
||||
@ -56,10 +67,18 @@ END_OF_DATA
|
||||
echo ""
|
||||
fi
|
||||
|
||||
#
|
||||
# The second alter changes ssl_type to new 4.0.2 format
|
||||
|
||||
echo "Adding columns needed by GRANT .. REQUIRE (openssl)"
|
||||
echo "You can ignore any Duplicate column errors"
|
||||
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
ALTER TABLE user ADD ssl_type enum('NONE','ANY','X509', 'SPECIFIED') DEFAULT 'NONE' NOT NULL, ADD ssl_cipher BLOB NOT NULL, ADD x509_issuer BLOB NOT NULL, ADD x509_subject BLOB NOT NULL
|
||||
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
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;
|
||||
ALTER TABLE user MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL;
|
||||
END_OF_DATA
|
||||
echo ""
|
||||
|
||||
@ -98,7 +117,7 @@ END_OF_DATA
|
||||
#
|
||||
|
||||
echo "Changing name of columns_priv.Type -> columns_priv.Column_priv"
|
||||
echo "You can ignore any errors from this"
|
||||
echo "You can ignore any Unknown column errors from this"
|
||||
|
||||
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL;
|
||||
@ -117,12 +136,41 @@ alter table func add type enum ('function','aggregate') NOT NULL;
|
||||
EOF
|
||||
echo ""
|
||||
|
||||
echo "Converting all privilege tables to MyISAM format"
|
||||
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
ALTER TABLE user type=MyISAM;
|
||||
ALTER TABLE db type=MyISAM;
|
||||
ALTER TABLE host type=MyISAM;
|
||||
ALTER TABLE func type=MyISAM;
|
||||
ALTER TABLE columns_priv type=MyISAM;
|
||||
ALTER TABLE tables_priv type=MyISAM;
|
||||
#
|
||||
# Change the user table to MySQL 4.0 format
|
||||
#
|
||||
|
||||
echo "Adding new fields used by MySQL 4.02 to the privilege tables"
|
||||
echo "You can ignore any Duplicate column errors"
|
||||
|
||||
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
alter table user
|
||||
add Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER alter_priv,
|
||||
add Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv,
|
||||
add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv,
|
||||
add Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv,
|
||||
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
|
||||
END_OF_DATA
|
||||
|
||||
if test $? -eq "0"
|
||||
then
|
||||
# Convert privileges so that users have similar privileges as before
|
||||
echo ""
|
||||
echo "Updating new privileges in MySQL 4.0.2 from old ones"
|
||||
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
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
|
||||
END_OF_DATA
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Add fields that can be used to limit number of questions and connections
|
||||
# for some users.
|
||||
|
||||
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
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;
|
||||
END_OF_DATA
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 1997, 1998, 1999 TCX DataKonsult AB & Monty Program KB & Detron HB
|
||||
# Copyright (C) 2002 MySQL AB
|
||||
# For a more info consult the file COPYRIGHT distributed with this file.
|
||||
|
||||
# This scripts creates the privilege tables db, host, user, tables_priv,
|
||||
@ -224,7 +224,14 @@ then
|
||||
c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u ssl_type enum('NONE','ANY','X509', 'SPECIFIED') DEFAULT 'NONE' NOT NULL,"
|
||||
c_u="$c_u Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
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 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,"
|
||||
c_u="$c_u x509_subject BLOB NOT NULL,"
|
||||
@ -235,14 +242,14 @@ then
|
||||
c_u="$c_u )"
|
||||
c_u="$c_u comment='Users and global privileges';"
|
||||
|
||||
i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','NONE','','','',0,0,0);
|
||||
INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','NONE','','','',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','','','','',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 ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','NONE','','','',0,0,0);
|
||||
REPLACE INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','NONE','','','',0,0,0);
|
||||
REPLACE 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);
|
||||
REPLACE 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 ('localhost','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','NONE','','','',0,0,0);
|
||||
INSERT INTO user VALUES ('$hostname','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','NONE','','','',0,0,0);"
|
||||
INSERT INTO user (host,user) values ('localhost','');
|
||||
INSERT INTO user (host,user) values ('$hostname','');"
|
||||
fi
|
||||
|
||||
if test ! -f $mdata/func.frm
|
||||
@ -343,7 +350,7 @@ then
|
||||
echo "cd @prefix@ ; $bindir/mysqld_safe &"
|
||||
echo
|
||||
echo "You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:"
|
||||
echo "cd sql-bench ; run-all-tests"
|
||||
echo "cd sql-bench ; perl run-all-tests"
|
||||
echo
|
||||
fi
|
||||
echo "Please report any problems with the @scriptdir@/mysqlbug script!"
|
||||
|
@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "This scripts updates the mysql.user, mysql.db, mysql.host and the"
|
||||
echo "mysql.func table to MySQL 3.22.14 and above."
|
||||
echo ""
|
||||
echo "This is needed if you want to use the new GRANT functions,"
|
||||
echo "CREATE AGGREAGATE FUNCTION or want to use the more secure passwords in 3.23"
|
||||
echo ""
|
||||
echo "If you get Access denied errors, you should run this script again"
|
||||
echo "and give the MySQL root user password as a argument!"
|
||||
|
||||
root_password="$1"
|
||||
host="localhost"
|
||||
|
||||
# Fix old password format, add File_priv and func table
|
||||
echo ""
|
||||
echo "If your tables are already up to date or partially up to date you will"
|
||||
echo "get some warnings about 'Duplicated column name'. You can safely ignore these!"
|
||||
|
||||
# Add fields that can be used to limit number of questions and connections
|
||||
# for some users.
|
||||
|
||||
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||
alter table user add max_questions int(11) NOT NULL, add max_updates int(11) unsigned NOT NULL, add max_connections int(11) unsigned NOT NULL;
|
||||
END_OF_DATA
|
Reference in New Issue
Block a user