MySQL 8.4.2
Source Code Documentation
sql_initialize.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef SQL_INITIALIZE_H
25#define SQL_INITIALIZE_H 1
26
27#include <string>
28
29#include "sql/bootstrap_impl.h"
30
32 public:
34 virtual ~Compiled_in_command_iterator() = default;
35 bool begin(void) override;
36 int next(std::string &query) override;
37 void report_error_details(log_function_t log) override;
38 void end(void) override;
39
40 private:
41 int m_cmds_ofs{0};
42 int m_cmd_ofs{0};
43};
44
45extern bool opt_initialize_insecure;
46bool initialize_create_data_directory(const char *data_home);
48
49/* Declarations below are for unit testing. */
50extern bool generate_password(char *password, int size);
51
52#define ALLOWED_PWD_UPCHARS "QWERTYUIOPASDFGHJKLZXCVBNM"
53#define ALLOWED_PWD_LOWCHARS "qwertyuiopasdfghjklzxcvbnm"
54#define ALLOWED_PWD_NUMCHARS "1234567890"
55#define ALLOWED_PWD_SYMCHARS ",.-+*;:_!#%&/()=?><"
56
57static constexpr const char g_allowed_pwd_chars[] =
60static constexpr const char g_upper_case_chars[] = ALLOWED_PWD_UPCHARS;
61static constexpr const char g_lower_case_chars[] = ALLOWED_PWD_LOWCHARS;
62static constexpr const char g_numeric_chars[] = ALLOWED_PWD_NUMCHARS;
63static constexpr const char g_special_chars[] = ALLOWED_PWD_SYMCHARS;
64
65#endif /* SQL_INITIALIZE_H */
Definition: sql_initialize.h:31
int m_cmd_ofs
Definition: sql_initialize.h:42
void report_error_details(log_function_t log) override
Definition: sql_initialize.cc:196
void end(void) override
End processing the iterator.
Definition: sql_initialize.cc:208
bool begin(void) override
start processing the iterator
Definition: sql_initialize.cc:139
virtual ~Compiled_in_command_iterator()=default
int m_cmds_ofs
Definition: sql_initialize.h:41
int next(std::string &query) override
Get the next query string.
Definition: sql_initialize.cc:178
Abstract interface to reading bootstrap commands.
Definition: bootstrap_impl.h:33
void(* log_function_t)(const char *message)
Definition: bootstrap_impl.h:35
static char * query
Definition: myisam_ftdump.cc:47
static char * password
Definition: mysql_secure_installation.cc:58
size_t size(const char *const c)
Definition: base64.h:46
bool generate_password(char *password, int size)
Definition: sql_initialize.cc:91
bool mysql_initialize_directory_freshly_created
True if –initialize has actually created the directory.
Definition: sql_initialize.cc:62
#define ALLOWED_PWD_UPCHARS
Definition: sql_initialize.h:52
#define ALLOWED_PWD_LOWCHARS
Definition: sql_initialize.h:53
static constexpr const char g_numeric_chars[]
Definition: sql_initialize.h:62
static constexpr const char g_special_chars[]
Definition: sql_initialize.h:63
#define ALLOWED_PWD_NUMCHARS
Definition: sql_initialize.h:54
bool initialize_create_data_directory(const char *data_home)
Create the data directory.
Definition: sql_initialize.cc:226
static constexpr const char g_upper_case_chars[]
Definition: sql_initialize.h:60
bool opt_initialize_insecure
Definition: sql_initialize.cc:60
#define ALLOWED_PWD_SYMCHARS
Definition: sql_initialize.h:55
static constexpr const char g_lower_case_chars[]
Definition: sql_initialize.h:61
static constexpr const char g_allowed_pwd_chars[]
Definition: sql_initialize.h:57