2010-10-20 16:56:09 +02:00
|
|
|
CREATE DATABASE test_user_db;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
|
|
|
========== test 1.1.3.2 ====================================
|
|
|
|
CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
|
|
|
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
|
|
|
GRANT PROXY ON plug_dest TO plug_user;
|
|
|
|
current_user()
|
|
|
|
plug_dest@%
|
|
|
|
user()
|
|
|
|
plug_user@localhost
|
|
|
|
Tables_in_test_user_db
|
|
|
|
t1
|
|
|
|
REVOKE PROXY ON plug_dest FROM plug_user;
|
|
|
|
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
|
|
|
|
DROP USER plug_user,plug_dest;
|
|
|
|
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
|
|
|
|
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
|
|
|
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
|
|
|
GRANT PROXY ON plug_dest TO plug_user;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
2011-07-02 22:12:12 +02:00
|
|
|
plug_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
plug_user test_plugin_server plug_dest
|
|
|
|
1)
|
|
|
|
current_user()
|
|
|
|
plug_dest@%
|
|
|
|
user()
|
|
|
|
plug_user@localhost
|
|
|
|
Tables_in_test_user_db
|
|
|
|
t1
|
2011-07-12 17:41:13 +02:00
|
|
|
REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user';
|
2010-10-20 16:56:09 +02:00
|
|
|
2)
|
|
|
|
current_user()
|
|
|
|
plug_dest@%
|
|
|
|
user()
|
|
|
|
plug_user@localhost
|
|
|
|
Tables_in_test_user_db
|
|
|
|
t1
|
|
|
|
REVOKE PROXY ON plug_dest FROM plug_user;
|
|
|
|
3)
|
|
|
|
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
|
|
|
|
DROP USER plug_user,plug_dest;
|
|
|
|
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
|
|
|
|
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
|
|
|
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
|
|
|
1)
|
|
|
|
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
|
|
|
|
GRANT PROXY ON plug_dest TO plug_user;
|
|
|
|
2)
|
|
|
|
current_user()
|
|
|
|
plug_dest@%
|
|
|
|
user()
|
|
|
|
plug_user@localhost
|
|
|
|
Tables_in_test_user_db
|
|
|
|
t1
|
2011-07-12 17:41:13 +02:00
|
|
|
REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user';
|
2010-10-20 16:56:09 +02:00
|
|
|
DROP USER plug_user,plug_dest;
|
|
|
|
========== test 1.2 ========================================
|
|
|
|
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
|
|
|
|
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
|
|
|
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
|
|
|
GRANT PROXY ON plug_dest TO plug_user;
|
|
|
|
current_user()
|
|
|
|
plug_dest@%
|
|
|
|
user()
|
|
|
|
plug_user@localhost
|
|
|
|
RENAME USER plug_dest TO new_dest;
|
|
|
|
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
|
|
|
|
GRANT PROXY ON new_dest TO plug_user;
|
|
|
|
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
2011-07-02 22:12:12 +02:00
|
|
|
new_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
plug_user test_plugin_server plug_dest
|
|
|
|
DROP USER plug_user,new_dest;
|
|
|
|
CREATE USER plug_user
|
|
|
|
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
|
|
|
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
|
|
|
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
|
|
|
|
GRANT PROXY ON plug_dest TO plug_user;
|
|
|
|
current_user()
|
|
|
|
plug_dest@%
|
|
|
|
user()
|
|
|
|
plug_user@localhost
|
|
|
|
RENAME USER plug_dest TO new_dest;
|
|
|
|
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
|
|
|
|
GRANT PROXY ON new_dest TO plug_user;
|
|
|
|
ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
2011-07-02 22:12:12 +02:00
|
|
|
new_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
plug_user test_plugin_server plug_dest
|
|
|
|
DROP USER plug_user,new_dest;
|
|
|
|
CREATE USER plug_user
|
|
|
|
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
|
|
|
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
|
|
|
GRANT PROXY ON plug_dest TO plug_user;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect plug_user,localhost,plug_user,plug_dest;
|
2010-10-20 16:56:09 +02:00
|
|
|
select USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
plug_user@localhost plug_dest@%
|
|
|
|
connection default;
|
|
|
|
disconnect plug_user;
|
|
|
|
RENAME USER plug_user TO new_user;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect plug_user,localhost,new_user,plug_dest;
|
2010-10-20 16:56:09 +02:00
|
|
|
select USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
new_user@localhost plug_dest@%
|
|
|
|
connection default;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
|
|
|
new_user test_plugin_server plug_dest
|
2011-07-02 22:12:12 +02:00
|
|
|
plug_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
disconnect plug_user;
|
|
|
|
UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
2011-07-02 22:12:12 +02:00
|
|
|
plug_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
plug_user test_plugin_server plug_dest
|
|
|
|
DROP USER plug_dest,plug_user;
|
|
|
|
========== test 1.3 ========================================
|
|
|
|
CREATE USER plug_user
|
|
|
|
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
|
|
|
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
|
|
|
GRANT PROXY ON plug_dest TO plug_user;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect plug_user,localhost,plug_user,plug_dest;
|
2010-10-20 16:56:09 +02:00
|
|
|
select USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
plug_user@localhost plug_dest@%
|
|
|
|
connection default;
|
|
|
|
disconnect plug_user;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
2011-07-02 22:12:12 +02:00
|
|
|
plug_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
plug_user test_plugin_server plug_dest
|
|
|
|
UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
|
|
|
new_user test_plugin_server plug_dest
|
2011-07-02 22:12:12 +02:00
|
|
|
plug_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
|
|
|
new_user test_plugin_server new_dest
|
2011-07-02 22:12:12 +02:00
|
|
|
plug_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
|
|
|
new_user new_plugin_server new_dest
|
2011-07-02 22:12:12 +02:00
|
|
|
plug_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
ERROR HY000: Plugin 'new_plugin_server' is not loaded
|
|
|
|
UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
|
|
|
|
UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
GRANT PROXY ON new_dest TO new_user;
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
2011-07-02 22:12:12 +02:00
|
|
|
new_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
new_user test_plugin_server new_dest
|
2016-03-25 17:51:22 +01:00
|
|
|
connect plug_user,localhost,new_user,new_dest;
|
2010-10-20 16:56:09 +02:00
|
|
|
select USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
new_user@localhost new_dest@%
|
|
|
|
connection default;
|
|
|
|
disconnect plug_user;
|
|
|
|
UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
2011-07-02 22:12:12 +02:00
|
|
|
new_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
new_user test_plugin_server new_dest
|
2011-07-02 22:12:12 +02:00
|
|
|
plug_dest
|
2010-10-20 16:56:09 +02:00
|
|
|
GRANT ALL PRIVILEGES ON test.* TO new_user;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect plug_user,localhost,new_dest,new_dest_passwd;
|
2010-10-20 16:56:09 +02:00
|
|
|
select USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
new_dest@localhost new_dest@%
|
|
|
|
connection default;
|
|
|
|
disconnect plug_user;
|
|
|
|
DROP USER new_user,new_dest,plug_dest;
|
|
|
|
========== test 2, 2.1, 2.2 ================================
|
2013-10-18 20:38:13 +02:00
|
|
|
CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
|
2010-10-20 16:56:09 +02:00
|
|
|
CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
|
|
|
test_plugin_server proxied_user
|
2011-07-02 22:12:12 +02:00
|
|
|
proxied_user
|
2016-03-25 17:51:22 +01:00
|
|
|
connect proxy_con,localhost,proxied_user,proxied_user_passwd;
|
2010-10-20 16:56:09 +02:00
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user@localhost proxied_user@%
|
|
|
|
========== test 2.2.1 ======================================
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
|
|
|
NULL
|
|
|
|
connection default;
|
|
|
|
disconnect proxy_con;
|
|
|
|
ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
|
2013-10-18 20:38:13 +02:00
|
|
|
GRANT PROXY ON proxied_user TO ''@'%%';
|
2016-03-25 17:51:22 +01:00
|
|
|
connect proxy_con,localhost,proxied_user,proxied_user_passwd;
|
2010-10-20 16:56:09 +02:00
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user@localhost proxied_user@%
|
|
|
|
connection default;
|
|
|
|
disconnect proxy_con;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect proxy_con,localhost,proxy_user,proxied_user;
|
2010-10-20 16:56:09 +02:00
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxy_user@localhost proxied_user@%
|
|
|
|
========== test 2.2.1 ======================================
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
2013-10-18 20:38:13 +02:00
|
|
|
''@'%%'
|
2010-10-20 16:56:09 +02:00
|
|
|
connection default;
|
|
|
|
disconnect proxy_con;
|
2013-10-18 20:38:13 +02:00
|
|
|
DROP USER ''@'%%',proxied_user;
|
|
|
|
GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'%%'
|
2010-10-20 16:56:09 +02:00
|
|
|
IDENTIFIED WITH test_plugin_server AS 'proxied_user';
|
|
|
|
CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
|
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
|
|
|
test_plugin_server proxied_user
|
2011-07-02 22:12:12 +02:00
|
|
|
proxied_user
|
2016-03-25 17:51:22 +01:00
|
|
|
connect proxy_con,localhost,proxied_user,proxied_user_passwd;
|
2010-10-20 16:56:09 +02:00
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user@localhost proxied_user@%
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
|
|
|
NULL
|
|
|
|
connection default;
|
|
|
|
disconnect proxy_con;
|
|
|
|
ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
|
2013-10-18 20:38:13 +02:00
|
|
|
GRANT PROXY ON proxied_user TO ''@'%%';
|
2016-03-25 17:51:22 +01:00
|
|
|
connect proxy_con,localhost,proxied_user,proxied_user_passwd;
|
2010-10-20 16:56:09 +02:00
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user@localhost proxied_user@%
|
|
|
|
connection default;
|
|
|
|
disconnect proxy_con;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect proxy_con,localhost,proxy_user,proxied_user;
|
2010-10-20 16:56:09 +02:00
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxy_user@localhost proxied_user@%
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
2013-10-18 20:38:13 +02:00
|
|
|
''@'%%'
|
2010-10-20 16:56:09 +02:00
|
|
|
connection default;
|
|
|
|
disconnect proxy_con;
|
2013-10-18 20:38:13 +02:00
|
|
|
DROP USER ''@'%%',proxied_user;
|
|
|
|
CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
|
2010-10-20 16:56:09 +02:00
|
|
|
CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd';
|
|
|
|
CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd';
|
|
|
|
CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd';
|
|
|
|
CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd';
|
|
|
|
CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd';
|
2013-10-18 20:38:13 +02:00
|
|
|
GRANT PROXY ON proxied_user_1 TO ''@'%%';
|
|
|
|
GRANT PROXY ON proxied_user_2 TO ''@'%%';
|
|
|
|
GRANT PROXY ON proxied_user_3 TO ''@'%%';
|
|
|
|
GRANT PROXY ON proxied_user_4 TO ''@'%%';
|
|
|
|
GRANT PROXY ON proxied_user_5 TO ''@'%%';
|
2010-10-20 16:56:09 +02:00
|
|
|
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
|
|
|
|
user plugin authentication_string
|
|
|
|
test_plugin_server proxied_user
|
2011-07-02 22:12:12 +02:00
|
|
|
proxied_user_1
|
|
|
|
proxied_user_2
|
|
|
|
proxied_user_3
|
|
|
|
proxied_user_4
|
|
|
|
proxied_user_5
|
2016-03-25 17:51:22 +01:00
|
|
|
connect proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd';
|
|
|
|
connect proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd;
|
|
|
|
connect proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd;
|
|
|
|
connect proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd;
|
|
|
|
connect proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd;
|
2010-10-20 16:56:09 +02:00
|
|
|
connection proxy_con_1;
|
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user_1@localhost proxied_user_1@%
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
|
|
|
NULL
|
|
|
|
connection proxy_con_2;
|
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user_2@localhost proxied_user_2@%
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
|
|
|
NULL
|
|
|
|
connection proxy_con_3;
|
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user_3@localhost proxied_user_3@%
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
|
|
|
NULL
|
|
|
|
connection proxy_con_4;
|
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user_4@localhost proxied_user_4@%
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
|
|
|
NULL
|
|
|
|
connection proxy_con_5;
|
|
|
|
SELECT USER(),CURRENT_USER();
|
|
|
|
USER() CURRENT_USER()
|
|
|
|
proxied_user_5@localhost proxied_user_5@%
|
|
|
|
SELECT @@proxy_user;
|
|
|
|
@@proxy_user
|
|
|
|
NULL
|
|
|
|
connection default;
|
|
|
|
disconnect proxy_con_1;
|
|
|
|
disconnect proxy_con_2;
|
|
|
|
disconnect proxy_con_3;
|
|
|
|
disconnect proxy_con_4;
|
|
|
|
disconnect proxy_con_5;
|
2013-10-18 20:38:13 +02:00
|
|
|
DROP USER ''@'%%',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5;
|
2010-10-20 16:56:09 +02:00
|
|
|
========== test 3 ==========================================
|
|
|
|
GRANT ALL PRIVILEGES ON *.* TO plug_user
|
|
|
|
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
|
|
|
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
|
|
|
GRANT PROXY ON plug_dest TO plug_user;
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
DROP USER plug_user, plug_dest;
|
|
|
|
DROP DATABASE test_user_db;
|