1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
###############################################################################
# #
# Variable name: password_history #
# Scope : GLOBAL #
# Access Type : Dynamic #
# Data type : Integer #
# Default value: 0 #
# Minimum Value: 0 #
# Maximum value: 4294967295 #
# #
# #
# Creation Date: 29-Nov-2017 #
# Author : Mohit Joshi #
# #
# Description : Test case added for dynamic server variable password_history #
# We check the behaviour of this variable for: #
# * Default values #
# * Valid and invalid values #
# * Scope and access method #
# #
# References: Reference: http://dev.mysql.com/doc/refman/8.0/en/ #
# server-system-variables.html #
# #
###############################################################################
################################################################
# Saving initial values of password_history variable in #
# a temporary variable #
################################################################
SET @password_history_save = @@global.password_history;
SELECT @password_history_save;
################################################################
# Display the DEFAULT value of password_history #
################################################################
--echo Default value must be 0 for global scope
SET @@global.password_history = 1;
SET @@global.password_history = DEFAULT;
SELECT @@global.password_history;
--error ER_GLOBAL_VARIABLE
SET @@session.password_history = 2;
--error ER_GLOBAL_VARIABLE
SET @@session.password_history = DEFAULT;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.password_history;
################################################################
# Check if NULL or empty value is accepted #
################################################################
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.password_history = NULL;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.password_history = '';
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.password_history = ' ';
--error ER_GLOBAL_VARIABLE
SET @@session.password_history = NULL;
--error ER_GLOBAL_VARIABLE
SET @@session.password_history = '';
--error ER_GLOBAL_VARIABLE
SET @@session.password_history = ' ';
##############################################################################
# Change the value of password_history to a valid value for GLOBAL scope #
##############################################################################
SET @@global.password_history = 0;
SELECT @@global.password_history;
SET @@global.password_history = 1;
SELECT @@global.password_history;
SET @@global.password_history = TRUE;
SELECT @@global.password_history;
SET @@global.password_history = FALSE;
SELECT @@global.password_history;
SET @@global.password_history = 4294967295;
SELECT @@global.password_history;
SET @@global.password_history = DEFAULT;
SELECT @@global.password_history;
#############################################################################
# Change the value of password_history to an invalid value for GLOBAL scope #
#############################################################################
SET @@global.password_history = -1;
SELECT @@global.password_history;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.password_history = 'ABC';
SELECT @@global.password_history;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.password_history = ON;
SELECT @@global.password_history;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.password_history = 'OFF';
SELECT @@global.password_history;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.password_history = 2.14;
SELECT @@global.password_history;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.password_history = NONE;
SELECT @@global.password_history;
SET @@global.password_history = -4294967295;
SELECT @@global.password_history;
SET @@global.password_history = 4294967296;
SELECT @@global.password_history;
#############################################################################
# Check if the value in GLOBAL Table matches value in variable #
#############################################################################
--echo Must return 1
--disable_warnings
SELECT @@global.password_history = VARIABLE_VALUE
FROM performance_schema.global_variables
WHERE VARIABLE_NAME='password_history';
--enable_warnings
###############################################################################
# Check if password_history variable can be accessed with and without @@ sign #
###############################################################################
SET GLOBAL password_history = 1;
SET @@global.password_history = 1;
--error ER_PARSE_ERROR
SET global.password_history = 1;
--error ER_GLOBAL_VARIABLE
SET @@password_history = 1;
--error ER_GLOBAL_VARIABLE
SET password_history = 1;
--error ER_UNKNOWN_TABLE
SELECT global.password_history;
--error ER_BAD_FIELD_ERROR
SELECT GLOBAL password_history;
SELECT @@password_history;
#############################################################################
# Restoring the original value of password_history variable #
#############################################################################
SET @@global.password_history = @password_history_save;
|