下载安装sysql所需包
client包的位置:(https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.40-1.el7.x86_64.rpm) common包的位置:(https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-common-5.7.40-1.el7.x86_64.rpm) devel包的位置:(https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-devel-5.7.40-1.el7.x86_64.rpm) libs包的位置:(https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-libs-5.7.40-1.el7.x86_64.rpm) server包的位置:(https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.40-1.el7.x86_64.rpm)
[root@node2 ~]# cd /usr/src/
[root@node2 src]# ls
debug kernels
[root@node2 src]# wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.40-1.el7.x86_64.rpm https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-common-5.7.40-1.el7.x86_64.rpm https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-devel-5.7.40-1.el7.x86_64.rpm https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-libs-5.7.40-1.el7.x86_64.rpm https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.40-1.el7.x86_64.rpm
#wget下载过程省略
[root@node2 src]# ls
debug
kernels
mysql-community-client-5.7.40-1.el7.x86_64.rpm
mysql-community-common-5.7.40-1.el7.x86_64.rpm
mysql-community-devel-5.7.40-1.el7.x86_64.rpm
mysql-community-libs-5.7.40-1.el7.x86_64.rpm
mysql-community-server-5.7.40-1.el7.x86_64.rpm
[root@node2 src]# yum -y localinstall *.rpm
#yum本地安装过程省略
关闭防火墙和selinux
[root@node2 ~]# systemctl disable --now firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@node2 ~]# vim /etc/selinux/config
# 修改SELINUX=disabled
[root@node2 ~]# setenforce 0
[root@node2 ~]#
启动mysqld
[root@node2 ~]# systemctl start mysqld
[root@node2 ~]# systemctl enable mysqld
[root@node2 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: >
Active: active (running) since Tue 2022-12-27 20:29:08 CST; 43s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 13600 (mysqld)
Tasks: 27 (limit: 4723)
Memory: 261.3M
CGroup: /system.slice/mysqld.service
└─13600 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.p>
Dec 27 20:29:05 node2 systemd[1]: Starting MySQL Server...
Dec 27 20:29:08 node2 systemd[1]: Started MySQL Server.
[root@node2 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@node2 ~]#
连接mysql
查找临时登录密码
[root@node2 ~]# grep password /var/log/mysqld.log
2022-12-27T12:29:06.834696Z 1 [Note] A temporary password is generated for root@localhost: ?8:m9W3w<q,p
[root@node2 ~]#
修改登录密码
[root@node2 ~]# mysql -uroot -p'?8:m9W3w<q,p'
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 2
Server version: 5.7.40
Copyright (c) 2000, 2022, 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> set password = password("RunTime123!");
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql>
连接mysql
[root@node2 ~]# mysql -uroot -p标签:x86,5.7,数据库,community,64,mysql,node2,安装 From: https://www.cnblogs.com/msl1105/p/17008964.html
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, 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>