In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "the method of installing MySQL in Linux environment". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the method of installing MySQL in Linux environment".
In the environment, after MySQL is installed, the service cannot be started directly and must be initialized first. The initialization work mainly includes:
Initialize the files necessary for the database such as logs, tablespaces, etc.
Create and initialize the system database ().
After initialization is complete, start the mysqld daemon before you can access the database.
In the Windows environment, an initialized environment is included in the installation package, which is expanded in the data subdirectory of the mysql root directory after installation. So you don't need to initialize it manually. However, in some cases, you may need to initialize the database from scratch, such as:
The data file is corrupted and needs to be rebuilt
Hope to keep the existing environment unchanged and establish a new environment
Hope to establish a clean environment.
Unfortunately, the mysql_install_db.sh script is used to initialize the database environment in the Linux environment; the corresponding script is not provided in the Windows version. So what should we do?
Through the analysis of mysql_install_db.sh in Linux environment, it is found that the command to initialize the database is mainly the following lines:
Where:
$create_system_tables, $fill_system_tables, and $fill_help_tables create the system database, initialize the data in the system database, and initialize the help data, respectively
Filter_cmd_line is to filter out the hostname (used to cross-initialize the non-native running database environment, which can be ignored)
$mysqld_install_cmd_line is mainly a "mysqld-- bootstrap" command
If you analyze the above clearly, you can initialize the database manually. The specific steps are as follows:
Set up the mysql profile. The main purpose is to set two parameters: basedir (home directory of mysql, such as: / opt/mysql-5.1.40) and datadir (database file directory, such as: / var/db/mysql).
Initialize the database directory, check that the / var/db/mysql and / var/db/mysql/mysql (system database) directories exist, and create them manually if they do not exist.
Prepare the sql script to initialize the database. Copy the mysql_system_tables.sql, mysql_system_tables_data.sql, and fill_help_tables.sql files from the / opt/mysql-5.1.40/share directory to the / tmp directory, and insert the line "use mysql;" at the beginning of each file.
Initialize the database by executing the following command:
/ opt/mysql-5.1.40/bin/mysqld.exe-bootstrap-console
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.