Install mysql (rpm version) on Linux system

Table of contents

Install mysql (rpm version) on Linux system

1. Check whether the MySQL database is installed in the current system

2. Upload the mysql installation package to Linux and decompress it

3. Install rpm packages in order

4. Start mysql

5. Set up auto-start at boot

6. View started services

7. View temporary password

8. Log in to mysql and enter the temporary password

9. Change password

10. Enable access permissions

11. Refresh files

12. Log in to the database again

13. View the database

14. Remote connection, turn off the firewall before connecting


Install mysql (rpm version) on Linux system

Link: https://pan.baidu.com/s/1VU_YRjB4SIXtA-SV98Nhkw?pwd=fyqv

Extraction code: fyqv

RPM (Red-Hat Package Manager) RPM package manager is a tool used by Red Hat Linux to manage and install software.

1. Check whether the MySQL database is installed in the current system

rpm -qa                    查询当前系统中安装的所有软件
rpm -qa | grep mysql       查询当前系统中安装的名称带mysql的软件
rpm -qa | grep mariadb     查询当前系统中安装的名称带mariadb的软件

Note: If the MySQL database is already installed in the current system, the installation will fail. Cento57 comes with mariadb and MySQL

Database conflict

The system’s own database

rpm -e --nodeps 软件名称        卸载软件

rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64

2. Upload the mysql installation package to Linux and decompress it

Here I uploaded it to the opt directory, created a mysql folder, and uploaded it to it.

 Unzip the file and enter the command in the current folder

tar -zxvf mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar.gz

After decompression, you will get 6 rpm installation package files.

3. Install rpm packages in order

rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpm

rpm -ivh mysql-community-devel-5.7.25-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-compat-5.7.25-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpm

yum install net-tools

rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm

Note: If the installation process prompts that the net-tools dependency is missing, use yum to install it.

Existing software and system kernel can be upgraded through commands:

yum update

4. Start mysql

systemctl status mysqld       查看mysql服务状态
systemctl start mysqld        启动mysql服务

 

5. Set up auto-start at boot

systemctl enable mysqld

6. View started services

netstat -tunlp                查看已经启动的服务

netstat -tunlp | grep mysql     
ps -ef | grep mysql            查看mysql进程

7. View temporary password

cat /var/log/mysqld.log             查看文件内容

cat /var/log/mysqld.log | grep password        查看指定文件内容

8. Log in to mysql and enter the temporary password

mysql -uroot -p

9. Change password

set global validate_password_length=4;        设置密码长度最低位数

set global validate_password_policy=LOW;      设置密码安全等级低,便于密码可以修改成root

set password = password('root');              设置密码为root

 

10. Enable access permissions

grant all on *.* to 'root'@'%' identified by 'root';

 

11. Refresh files

flush privileges;

12. Log in to the database again

mysql -uroot -proot

13. View the database

show databases;

14. Remote connection, turn off the firewall before connecting

systemctl disable firewalld

 

Guess you like

Origin blog.csdn.net/qi341500/article/details/129462600