Home > Database > Mysql Tutorial > linux tar installation mysql

linux tar installation mysql

王林
Release: 2023-05-20 14:38:38
Original
1494 people have browsed it

In Linux systems, MySQL is a very common relational database management system. When installing MySQL, we can choose to install it through a tar compressed package. Next, this article will introduce in detail the process of installing MySQL through tar in Linux systems.

Step one: Download the MySQL installation package

First, we need to download the MySQL installation package from the official MySQL website. On the download page, you can choose the following MySQL version:

linux tar installation mysql

In this article, we chose the Community Edition 5.7 version of MySQL for installation. After selecting the corresponding version, we need to click the "Download" button to download.

Step 2: Decompress the MySQL installation package

After the download is completed, we need to decompress the MySQL compressed package. The unzipped folder contains all MySQL installation files. When decompressing, we can use the following command:

tar zxvf mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
Copy after login

Among them, mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz is the name of the MySQL installation package we downloaded. After using this command, you can decompress the file and generate a folder named mysql-5.7.34-linux-glibc2.12-x86_64.

Step 3: Install MySQL

After decompression, we move the mysql-5.7.34-linux-glibc2.12-x86_64 folder to the directory where we want to install MySQL. After moving the folder, we need to enter the folder:

cd /usr/local

cp -r /path/to/mysql-5.7.34-linux-glibc2.12-x86_64 .
Copy after login

After entering the mysql-5.7.34-linux-glibc2.12-x86_64 folder, we need to perform the initialization settings of MySQL. We can use the following command to initialize and configure the root user:

cd mysql-5.7.34-linux-glibc2.12-x86_64

./bin/mysqld --initialize --user=mysql

./bin/mysql_secure_installation
Copy after login

In the above command, we used the mysqld command to initialize MySQL. After the initialization is completed, we need to use the mysql_secure_installation command to set the root user's password, permissions and other information.

Step 4: Start the MySQL service

Start the MySQL service through the following command:

./bin/mysqld_safe &
Copy after login

After starting the service, we need to use the following command to log in to MySQL:

./bin/mysql -u root -p
Copy after login

At this point, the system will prompt us to enter the root user password we set previously. After successfully logging in, we can happily use MySQL.

Summary:

Through the above method, we introduced in detail how to install MySQL through tar in the Linux system and perform the corresponding initialization settings and operations. It should be noted that when using MySQL, we must pay attention to the security and stability of the environment. At the same time, we must also understand as much as possible the specific operations of MySQL and its security issues.

The above is the detailed content of linux tar installation mysql. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template