1、操作系统
os:Linux
csa:RHEL9
信创:国产化
CentOS Linux 7(以下简称CentOS 7)将于2024年6月30 停止更新。
CentOS Linux 8(以下简称CentOS 8)已于2021年12月31日停止更新和发布(EOL,End Of Life)。
CentOS7 停服后应对方案
1、RHEL7 可以继续使用,高级功能订阅。
2、Rocky Linux 8/9 ,所有功能免费开放。
3、AlmaLinux 8/9,RHEL 100% 二进制兼容的
4、Oracle Linux 7/8/9
国产化Linux:
1、OpenEuler 欧拉
2、kylinos 麒麟
3、天翼云CTyunOS
2、部署OpenEuler
1、获取iso
openEuler-22.03-LTS-x86_64-dvd.iso
2、安装os
手动设置固定IP,建议大家网卡vm net8
网关:x.x.x.2
DNS:114.114.114.114
8.8.8.8
阿里:223.5.5.5,223.6.6.6
设置root密码,取消锁定root用户
复杂性要求:
1、3种类型:大写字母、小写字母、数字和特殊字符
2、长度》=8
3、不能是密码字典已有,比如 redhat cisco, RedHat@123-- 无法通过
lhylove5201314
3、远程连接
xshell、xftp
更改密码
[root@localhost ~]# echo 123456 | passwd --stdin root
更改用户 root 的密码 。
passwd:所有的身份验证令牌已经成功更新。
关闭防火墙
[root@localhost ~]# firewall-cmd --state # 查看防火墙状态
running
[root@localhost ~]# systemctl stop firewalld # 当前终端关闭防火墙
[root@localhost ~]# systemctl disable firewalld # 开机禁用防护哟亲
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# firewall-cmd --state
not running
禁用SELinux
[root@localhost ~]# getenforce # 查看状态
Enforcing
[root@localhost ~]# sed -i '/^SELINUX=/ c SELINUX=disabled' /etc/selinux/config
# 修改完毕,重启系统生效
# 临时修改selinux 模式为宽容模式
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
安装 MySQL 8.0
安装简单,无法自定义安装版本,安装时间取决于网络状况。适合于学习环境。
1、查询版本
[root@localhost ~]# yum list | grep -i ^mysql
...
mysql-server.x86_64 8.0.38-1.oe2203sp4 openEuler-update
2、安装 MySQL 8.0.38
[root@localhost ~]# yum install -y mysql-server
3、启动MySQL
[root@localhost ~]# systemctl enable --now mysqld
# 检查启动成功与否?
# 方法1: 查看端口 3306
[root@localhost ~]# netstat -lnupt | grep :3306
tcp6 0 0 :::33060 :::* LISTEN 2690/mysqld
tcp6 0 0 :::3306 :::* LISTEN 2690/mysqld
# 方法2: 查看服务状态
[root@localhost ~]# systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2024-09-08 18:43:09 CST; 1min 54s ago
Process: 2590 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Process: 2613 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
Main PID: 2690 (mysqld)
Status: "Server is operational"
Tasks: 37 (limit: 21421)
Memory: 453.8M
CGroup: /system.slice/mysqld.service
└─2690 /usr/libexec/mysqld --basedir=/usr
9月 08 18:42:53 localhost.localdomain systemd[1]: Starting MySQL 8.0 database server...
9月 08 18:42:53 localhost.localdomain mysql-prepare-db-dir[2613]: Initializing MySQL database
9月 08 18:43:09 localhost.localdomain systemd[1]: Started MySQL 8.0 database server.
# 方法3: 查看进程
[root@localhost ~]# ps -ef | grep mysqld
mysql 2690 1 4 18:43 ? 00:00:07 /usr/libexec/mysqld --basedir=/usr
root 2750 1579 0 18:45 pts/1 00:00:00 grep --color=auto mysqld
# 方法4: 通过 lsof 反查 端口
[root@localhost ~]# yum install lsof -y
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 2690 mysql 33u IPv6 28819 0t0 TCP *:mysql (LISTEN)
4、测试登录
命令:
本地登录: mysql -uroot -p'密码'
秘密如何获取?
[root@localhost ~]# grep password /var/log/mysql/mysqld.log
2024-09-08T10:42:58.888881Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.38 Source distribution
Copyright (c) 2000, 2024, 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> \q
Bye
[root@localhost ~]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.38 Source distribution
Copyright (c) 2000, 2024, 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> \q
Bye
退出:quit,或者 bye,或者 \q, 或者 ^D。