MySQL 8.0.40
Source Code Documentation
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include "client/client_priv.h"
#include "my_alloc.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_default.h"
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_shm_defaults.h"
#include "mysql/service_mysql_alloc.h"
#include "mysqld_error.h"
#include "print_version.h"
#include "typelib.h"
#include "welcome_copyright_notice.h"
#include "sslopt-vars.h"
#include "sslopt-longopts.h"
#include "sslopt-case.h"
Functions | |
static void | usage () |
static void | free_resources () |
static bool | my_arguments_get_one_option (int optid, const struct my_option *opt, char *argument) |
static void | init_connection_options (MYSQL *mysql) |
static int | get_response (const char *opt_message, int default_answer=-1) |
Reads the response from stdin and returns the first character. More... | |
static void | execute_query_with_message (const char *query, const char *opt_message) |
Takes a mysql query and an optional message as arguments. More... | |
static bool | execute_query (const char **query, size_t length) |
Takes a mysql query and the length of the query in bytes as the input. More... | |
static bool | validate_password_exists () |
Checks if the validate_password component is installed and returns true if it is. More... | |
static int | install_password_validation_component () |
Installs validate_password component and sets the password validation policy. More... | |
static void | estimate_password_strength (char *password_string) |
Checks the password strength and displays it to the user. More... | |
static bool | mysql_set_password (MYSQL *mysql, char *password) |
During rpm deployments the password expires immediately and needs to be renewed before the DBA can set the final password. More... | |
static bool | mysql_expire_password (MYSQL *mysql) |
Expires the password for all users if executed with sufficient privileges. More... | |
static void | set_opt_user_password (int component_set) |
Sets the user password with the string provided during the flow of the method. More... | |
static int | get_opt_user_password () |
Takes the opt_user's password as an input from the user and checks its validity by trying to connect to the server with it. More... | |
static void | drop_users (MYSQL_RES *result) |
Takes the user and the host from result set and drops those users. More... | |
static void | remove_anonymous_users () |
Removes all the anonymous users for better security. More... | |
static void | remove_remote_root () |
Drops all the root users with a remote host. More... | |
static void | remove_test_database () |
Removes test database and deletes the rows corresponding to them from mysql.db table. More... | |
static void | reload_privilege_tables () |
Refreshes the in-memory details through FLUSH PRIVILEGES. More... | |
int | main (int argc, char *argv[]) |
Variables | |
static MEM_ROOT | argv_alloc {PSI_NOT_INSTRUMENTED, 512} |
static char * | opt_host = nullptr |
static char * | opt_user = nullptr |
static uint | opt_port = 0 |
static uint | opt_protocol = 0 |
static char * | opt_socket = nullptr |
static MYSQL | mysql |
static char * | password = nullptr |
static bool | password_provided = false |
static bool | g_expire_password_on_exit = false |
static bool | opt_use_default = false |
static const char * | load_default_groups [] |
static struct my_option | my_connection_options [] |
|
static |
Takes the user and the host from result set and drops those users.
result | The result set from which rows are to be fetched. |
|
static |
Checks the password strength and displays it to the user.
password_string | Password string whose strength is to be estimated |
|
static |
Takes a mysql query and the length of the query in bytes as the input.
If the query fails on running, a message along with the failure details is displayed.
query | The mysql query which is to be executed. |
length | Length of the query in bytes. |
|
static |
Takes a mysql query and an optional message as arguments.
It displays the message if provided one and then runs the query. If the query is run successfully, the success message is displayed. Else, the failure message along with the actual failure is displayed. If the server is not found running, the program is exited.
query | The mysql query which is to be executed. |
opt_message | The optional message to be displayed. |
|
static |
|
static |
Takes the opt_user's password as an input from the user and checks its validity by trying to connect to the server with it.
The connection to the server is opened in this function.
|
static |
Reads the response from stdin and returns the first character.
If global variable opt_use_default is true then the default_answer is returned instead.
opt_message | Optional message do be displayed. |
default_answer | Answer to be given if no interactivity is allowed. |
|
static |
|
static |
Installs validate_password component and sets the password validation policy.
int main | ( | int | argc, |
char * | argv[] | ||
) |
|
static |
|
static |
Expires the password for all users if executed with sufficient privileges.
This is primarily used as a helper function during rpm deployments.
mysql | The MYSQL handle |
Function might fail with an error message which can be retrieved using mysql_error(mysql)
true | success |
false | failure |
|
static |
During rpm deployments the password expires immediately and needs to be renewed before the DBA can set the final password.
This helper subroutine will use an active connection to set a password.
mysql | The MYSQL handle |
password | A password character string |
Function might fail with an error message which can be retrieved using mysql_error(mysql)
true | success |
false | failure |
|
static |
Refreshes the in-memory details through FLUSH PRIVILEGES.
|
static |
Removes all the anonymous users for better security.
|
static |
Drops all the root users with a remote host.
|
static |
Removes test database and deletes the rows corresponding to them from mysql.db table.
|
static |
Sets the user password with the string provided during the flow of the method.
It checks for the strength of the password before changing it and displays the same to the user. The user can decide if he wants to continue with the password, or provide a new one, depending on the strength displayed.
component_set | 1 if validate_password component is set and 0 if it is not. |
|
static |
|
static |
Checks if the validate_password component is installed and returns true if it is.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |