Three installation methods of MySQL database under Linux system

One, yum online installation

1. Download and install the official yum repository of mysql, and select the version corresponding to your own virtual machine (I downloaded Red Hat 8.3, and the corresponding version of el is 8)

[root@localhost ~]# dnf install https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm

2. Install mysql-server directly

 

3. Start the mysql service and check the startup status of mysql

systemctl start mysqld.service
systemctl status mysqld.service

4. Check the temporary password

grep 'temporary password' /var/log/mysql/mysqld.log

Note: Different system versions have slight differences in viewing passwords. The RHEL8 viewing path installed on this host is the above path, and the temporary password storage path of RHEL9 is /var/log/mysqld.log. In addition, the value of the temporary password is also different. , RHEL9 can filter out the password randomly generated by the system according to this command, but in RHEL8, the filtered password is empty, just press Enter when entering the password in reality

5. Use a temporary password to log in

mysql -uroot -p

6. If you need to change the password, use the following statement

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

Note: MySQL is not case-sensitive, commas are used as separators, and semicolons are used as the end

2. Local rpm installation

1. Download mysql-8.0.30-1.el9.x86_64.rpm-bundle from the official website, and use xftp to transfer the files downloaded by windows

2. Unzip the rpm-bundle file

tar xvf mysql-8.0.30-1.el9.x86_64.rpm-bundle.tar

3. Use the dnf command to install

dnf localinstall mysql-community-server-8.0.30-1.el9.x86_64.rpm

Other operations are similar to warehouse installation

3. Source code installation

1. Create a directory for storing compressed files

mkdir /mysql
mv mysql-boost-8.0.29.tar.gz /mysql/
cd /mysql/
tar xvf mysql-boost-8.0.29.tar.gz

2. After the decompression is complete, perform the following operations

cd mysql-8.0.29/
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
mkdir bld
cd /bld/
cmake gcc gcc-c++
yum install gcc-toolset-11-gcc gcc-toolset-11-gcc-c++ gcc-toolset-11-binutils ncurses-devel libtripc-devel

3. Download the files required for source code compilation

rpm -i rpcgen-1.3.1-4.el8.x86_64.rpm

4. Execute cmake to start compiling

cmake ..-DOWNLOAD_BOOST=1

Tips: You can add corresponding parameter entries after cmake according to the subsequent error prompts until the compilation is successful

5. After the above operations are completed, perform make in the virtual machine terminal, because the source code compilation takes a long time to run, and the suspend operation can be performed in the virtual machine terminal, and the program will not be affected after the computer is turned off to continue compiling

make;make install

Guess you like

Origin blog.csdn.net/AChain1117/article/details/126178581