Domestic yum source:
https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/
https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/
Create a .repo file of yum source, for example: The centos7 version creates mariadb.repo
vim /etc/yum.repo.d/mariadb.repo
[mariadb]
name=mariadb
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.3.27/yum/centos7-amd64/
gpgcheck=0
enabled=1
Update yum warehouse:yum clean all ;yum repolist
Install: yum install mariadb-server
oryum install mysql-community-server
Problem: There may be an error when installing the rpm package of mysql8.0: --nogpgcheck
try to solve it after adding the command
warning: /var/cache/yum/x86_64/7/mysql/packages/mysql-community-libs-8.0.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
The mysql8.0 system prohibits the root user from logging in without a password, and priority must be given to security initialization. The temporary password is/var/log/mysqld.log
[root@centos7 ~]# tail /var/log/mysqld.log
2020-12-22T11:51:49.619226Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-22T11:51:50.439428Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-22T11:51:51.326163Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Qj*i9Z7hagfd
2020-12-22T11:51:53.734548Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22) starting as process 1355
2020-12-22T11:51:53.744559Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-22T11:51:54.284969Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-22T11:51:54.438844Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2020-12-22T11:51:54.656419Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-12-22T11:51:54.656676Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-22T11:51:54.682408Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
[root@centos7 ~]# ll /var/lib/mysql