MySQL 8.0.30
Source Code Documentation
sql_initialize.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2022, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef SQL_INITIALIZE_H
24#define SQL_INITIALIZE_H 1
25
26#include <string>
27
28#include "sql/bootstrap_impl.h"
29
31 public:
33 virtual ~Compiled_in_command_iterator() = default;
34 bool begin(void) override;
35 int next(std::string &query) override;
36 void report_error_details(log_function_t log) override;
37 void end(void) override;
38
39 private:
40 int m_cmds_ofs{0};
41 int m_cmd_ofs{0};
42};
43
44extern bool opt_initialize_insecure;
45bool initialize_create_data_directory(const char *data_home);
47
48/* Declarations below are for unit testing. */
49extern bool generate_password(char *password, int size);
50
51#define ALLOWED_PWD_UPCHARS "QWERTYUIOPASDFGHJKLZXCVBNM"
52#define ALLOWED_PWD_LOWCHARS "qwertyuiopasdfghjklzxcvbnm"
53#define ALLOWED_PWD_NUMCHARS "1234567890"
54#define ALLOWED_PWD_SYMCHARS ",.-+*;:_!#%&/()=?><"
55
56static constexpr const char g_allowed_pwd_chars[] =
59static constexpr const char g_upper_case_chars[] = ALLOWED_PWD_UPCHARS;
60static constexpr const char g_lower_case_chars[] = ALLOWED_PWD_LOWCHARS;
61static constexpr const char g_numeric_chars[] = ALLOWED_PWD_NUMCHARS;
62static constexpr const char g_special_chars[] = ALLOWED_PWD_SYMCHARS;
63
64#endif /* SQL_INITIALIZE_H */
Definition: sql_initialize.h:30
int m_cmd_ofs
Definition: sql_initialize.h:41
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:40
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:32
void(* log_function_t)(const char *message)
Definition: bootstrap_impl.h:34
static char * query
Definition: myisam_ftdump.cc:44
static char * password
Definition: mysql_secure_installation.cc:55
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:51
#define ALLOWED_PWD_LOWCHARS
Definition: sql_initialize.h:52
static constexpr const char g_numeric_chars[]
Definition: sql_initialize.h:61
static constexpr const char g_special_chars[]
Definition: sql_initialize.h:62
#define ALLOWED_PWD_NUMCHARS
Definition: sql_initialize.h:53
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:59
bool opt_initialize_insecure
Definition: sql_initialize.cc:60
#define ALLOWED_PWD_SYMCHARS
Definition: sql_initialize.h:54
static constexpr const char g_lower_case_chars[]
Definition: sql_initialize.h:60
static constexpr const char g_allowed_pwd_chars[]
Definition: sql_initialize.h:56