Modify network source
Connecting to 192.168.182.154:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Activate the web console with: systemctl enable --now cockpit.socket
/usr/bin/xauth: file /root/.Xauthority does not exist
[root@mysql2 ~]# vi /etc/yum.repos.d/
[root@mysql2 yum.repos.d]# cat CentOS-Base.repo
[base]
name=CentOS-8-stream - Base - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
#additional packages that may be useful
[extras]
name=CentOS-8-stream - Extras - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/extras/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-8-stream - Plus - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
[PowerTools]
name=CentOS-8-stream - PowerTools - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
[AppStream]
name=CentOS-8-stream - AppStream - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
[root@mysql2 yum.repos.d]#
[root@mysql2 ~]# cd /etc/yum.repos.d/
[root@mysql2 yum.repos.d]# ls
CentOS-Linux-AppStream.repo CentOS-Linux-Devel.repo CentOS-Linux-Media.repo
CentOS-Linux-BaseOS.repo CentOS-Linux-Extras.repo CentOS-Linux-Plus.repo
CentOS-Linux-ContinuousRelease.repo CentOS-Linux-FastTrack.repo CentOS-Linux-PowerTools.repo
CentOS-Linux-Debuginfo.repo CentOS-Linux-HighAvailability.repo CentOS-Linux-Sources.repo
[root@mysql2 yum.repos.d]# mkdir /tmp/yumrepo
[root@mysql2 yum.repos.d]# mv * /tmp/yumrepo/
[root@mysql2 yum.repos.d]# ls
[root@mysql2 yum.repos.d]# vi CentOS-Base.repo
[root@mysql2 yum.repos.d]# yum clean all
0 files removed
[root@mysql2 yum.repos.d]# yum makecache
CentOS-8-stream - Base - mirrors.aliyun.com 865 kB/s | 41 MB 00:48
CentOS-8-stream - Extras - mirrors.aliyun.com 30 kB/s | 18 kB 00:00
CentOS-8-stream - AppStream - mirrors.aliyun.com 565 kB/s | 31 MB 00:55
Metadata cache created.
Download the release package of mysql
[root@mysql2 yum.repos.d]# wget https://dev.mysql.com/get/mysql80-community-release-el8-5.noarch.rpm
--2023-07-11 11:38:48-- https://dev.mysql.com/get/mysql80-community-release-el8-5.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 23.203.224.66, 2600:1417:76:795::2e31, 2600:1417:76:788::2e31
Connecting to dev.mysql.com (dev.mysql.com)|23.203.224.66|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://repo.mysql.com//mysql80-community-release-el8-5.noarch.rpm [following]
--2023-07-11 11:38:49-- https://repo.mysql.com//mysql80-community-release-el8-5.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 184.25.232.250
Connecting to repo.mysql.com (repo.mysql.com)|184.25.232.250|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14948 (15K) [application/x-redhat-package-manager]
Saving to: ‘mysql80-community-release-el8-5.noarch.rpm’
mysql80-community-release-e 100%[========================================>] 14.60K --.-KB/s in 0s
2023-07-11 11:38:50 (158 MB/s) - ‘mysql80-community-release-el8-5.noarch.rpm’ saved [14948/14948]
[root@mysql2 yum.repos.d]# ls
CentOS-Base.repo mysql80-community-release-el8-5.noarch.rpm
[root@mysql2 yum.repos.d]# rpm -ivh mysql80-community-release-el8-5.noarch.rpm
warning: mysql80-community-release-el8-5.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql80-community-release-el8-5 ################################# [100%]
Warning: native mysql package from platform vendor seems to be enabled.
Please consider to disable this before installing packages from repo.mysql.com.
Run: yum module -y disable mysql
[root@mysql2 yum.repos.d]# yum repolist enabled
repo id repo name
AppStream CentOS-8-stream - AppStream - mirrors.aliyun.com
base CentOS-8-stream - Base - mirrors.aliyun.com
extras CentOS-8-stream - Extras - mirrors.aliyun.com
mysql-connectors-community MySQL Connectors Community
mysql-tools-community MySQL Tools Community
mysql80-community MySQL 8.0 Community Server
install mysql
[root@mysql2 yum.repos.d]# yum install -y mysql-community-server
MySQL 8.0 Community Server 1.8 MB/s | 2.9 MB 00:01
MySQL Connectors Community 177 kB/s | 93 kB 00:00
MySQL Tools Community 811 kB/s | 720 kB 00:00
All matches were filtered out by modular filtering for argument: mysql-community-server
Error: Unable to find a match: mysql-community-server
[root@mysql2 yum.repos.d]# yum module disable mysql
Last metadata expiration check: 0:01:20 ago on Tue 11 Jul 2023 11:39:53 AM CST.
Dependencies resolved.
=============================================================================================================
Package Architecture Version Repository Size
=============================================================================================================
Disabling modules:
mysql
Transaction Summary
=============================================================================================================
Is this ok [y/N]: y
Complete!
[root@mysql2 yum.repos.d]# yum install -y mysql-community-server
Last metadata expiration check: 0:01:30 ago on Tue 11 Jul 2023 11:39:53 AM CST.
Dependencies resolved.
=============================================================================================================
Package Architecture Version Repository Size
=============================================================================================================
Installing:
mysql-community-server x86_64 8.0.33-1.el8 mysql80-community 64 M
Installing dependencies:
mysql-community-client x86_64 8.0.33-1.el8 mysql80-community 16 M
mysql-community-client-plugins x86_64 8.0.33-1.el8 mysql80-community 3.5 M
mysql-community-common x86_64 8.0.33-1.el8 mysql80-community 667 k
mysql-community-icu-data-files x86_64 8.0.33-1.el8 mysql80-community 2.1 M
mysql-community-libs x86_64 8.0.33-1.el8 mysql80-community 1.5 M
Transaction Summary
=============================================================================================================
Install 6 Packages
Total download size: 89 M
Installed size: 417 M
Downloading Packages:
(1/6): mysql-community-common-8.0.33-1.el8.x86_64.rpm 1.0 MB/s | 667 kB 00:00
(2/6): mysql-community-client-plugins-8.0.33-1.el8.x86_64.rpm 3.2 MB/s | 3.5 MB 00:01
(3/6): mysql-community-libs-8.0.33-1.el8.x86_64.rpm 2.3 MB/s | 1.5 MB 00:00
(4/6): mysql-community-icu-data-files-8.0.33-1.el8.x86_64.rpm 734 kB/s | 2.1 MB 00:02
(5/6): mysql-community-client-8.0.33-1.el8.x86_64.rpm 2.6 MB/s | 16 MB 00:06
(6/6): mysql-community-server-8.0.33-1.el8.x86_64.rpm 4.4 MB/s | 64 MB 00:14
-------------------------------------------------------------------------------------------------------------
Total 5.4 MB/s | 89 MB 00:16
MySQL 8.0 Community Server 3.0 MB/s | 3.1 kB 00:00
Importing GPG key 0x3A79BD29:
Userid : "MySQL Release Engineering <[email protected]>"
Fingerprint: 859B E8D7 C586 F538 430B 19C2 467B 942D 3A79 BD29
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Key imported successfully
MySQL 8.0 Community Server 1.9 MB/s | 1.9 kB 00:00
Importing GPG key 0x5072E1F5:
Userid : "MySQL Release Engineering <[email protected]>"
Fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mysql-community-common-8.0.33-1.el8.x86_64 1/6
Installing : mysql-community-client-plugins-8.0.33-1.el8.x86_64 2/6
Installing : mysql-community-libs-8.0.33-1.el8.x86_64 3/6
Running scriptlet: mysql-community-libs-8.0.33-1.el8.x86_64 3/6
Installing : mysql-community-client-8.0.33-1.el8.x86_64 4/6
Installing : mysql-community-icu-data-files-8.0.33-1.el8.x86_64 5/6
Running scriptlet: mysql-community-server-8.0.33-1.el8.x86_64 6/6
Installing : mysql-community-server-8.0.33-1.el8.x86_64 6/6
Running scriptlet: mysql-community-server-8.0.33-1.el8.x86_64 6/6
[/usr/lib/tmpfiles.d/pesign.conf:1] Line references path below legacy directory /var/run/, updating /var/run/pesign → /run/pesign; please update the tmpfiles.d/ drop-in file accordingly.
Verifying : mysql-community-client-8.0.33-1.el8.x86_64 1/6
Verifying : mysql-community-client-plugins-8.0.33-1.el8.x86_64 2/6
Verifying : mysql-community-common-8.0.33-1.el8.x86_64 3/6
Verifying : mysql-community-icu-data-files-8.0.33-1.el8.x86_64 4/6
Verifying : mysql-community-libs-8.0.33-1.el8.x86_64 5/6
Verifying : mysql-community-server-8.0.33-1.el8.x86_64 6/6
Installed:
mysql-community-client-8.0.33-1.el8.x86_64 mysql-community-client-plugins-8.0.33-1.el8.x86_64
mysql-community-common-8.0.33-1.el8.x86_64 mysql-community-icu-data-files-8.0.33-1.el8.x86_64
mysql-community-libs-8.0.33-1.el8.x86_64 mysql-community-server-8.0.33-1.el8.x86_64
Complete!
[root@mysql2 yum.repos.d]# ps -ef |grep mysql
avahi 1064 1 0 11:32 ? 00:00:00 avahi-daemon: running [mysql2.local]
root 41783 6786 0 11:42 pts/0 00:00:00 grep --color=auto mysql
Start the mysql service:
[root@mysql2 yum.repos.d]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
[root@mysql2 yum.repos.d]# systemctl start mysqld
[root@mysql2 yum.repos.d]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2023-07-11 11:47:28 CST; 2s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 41851 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 41926 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 23372)
Memory: 491.1M
CGroup: /system.slice/mysqld.service
└─41926 /usr/sbin/mysqld
Jul 11 11:47:22 mysql2 systemd[1]: Starting MySQL Server...
Jul 11 11:47:28 mysql2 systemd[1]: Started MySQL Server.
[root@mysql2 yum.repos.d]#
The title is set to start from startup:
[root@mysql2 yum.repos.d]# systemctl enable mysqld
[root@mysql2 yum.repos.d]#
Check the version of mysql:
[root@mysql2 yum.repos.d]# mysqld -V
/usr/sbin/mysqld Ver 8.0.33 for Linux on x86_64 (MySQL Community Server - GPL)
[root@mysql2 yum.repos.d]# systemctl enable mysqld
[root@mysql2 yum.repos.d]#
Title Login and Reset Password
[root@mysql2 yum.repos.d]# grep password /var/log/mysqld.log
2023-07-11T03:47:25.663279Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ?=yRwMzj9eS=
[root@mysql2 yum.repos.d]# mysql -u root -p -h localhost
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@mysql2 yum.repos.d]# mysql -u root -p?=yRwMzj9eS= -h localhost
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.33
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user 'root'@'localhost' identified by "123456";
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> alter user 'root'@'localhost' identified by "Demo12345!";
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql>