安装mysql
简介
mysql是运行程序数据库的服务。这里的安装方式属于服务器能访问外网的安装方式,如果已安装mysql请忽略这一步
安装
1、检查是否安装了mysql
rpm -qa | grep mysql说明:若返回空信息,就说明当前环境没有安装MySQL
如已经安装,卸载已安装的mysql,不检查依赖关系
rpm -e --nodeps 已经安装程序名称命令举例:
[zhang@node4 yum.repos.d]$ su root
Password:
[root@node4 yum.repos.d]# rpm -e --nodeps mysql-community-libs-compat-8.0.36-1.el7.x86_64
[root@node4 yum.repos.d]# rpm -e --nodeps mysql-community-client-plugins-8.0.36-1.el7.x86_64
[root@node4 yum.repos.d]# rpm -e --nodeps mysql-community-libs-8.0.36-1.el7.x86_64
[root@node4 yum.repos.d]# rpm -e --nodeps mysql-community-server-8.0.36-1.el7.x86_64
[root@node4 yum.repos.d]# rpm -e --nodeps mysql-community-client-8.0.36-1.el7.x86_64
[root@node4 yum.repos.d]# rpm -e --nodeps mysql-community-common-8.0.36-1.el7.x86_64
[root@node4 yum.repos.d]# rpm -e --nodeps mysql80-community-release-el7-8.noarch
[root@node4 yum.repos.d]# rpm -e --nodeps mysql-community-icu-data-files-8.0.36-1.el7.x86_64
[root@node4 yum.repos.d]# rpm -qa | grep mysql2、检查当前环境是否有自带的mariadb数据库
rpm -qa | grep mariadb说明:若返回空信息,就说明当前环境没有安装mariadb;
3、打开页面MySQL - yum 下载源找到跟当前系统版本匹配的yum源,点击【Download】。

鼠标右击【No thanks, just start my download】来复制链接地址,安装的时候要使用。

yum -y localinstall 复制的地址
~]# yum -y localinstall https://dev.mysql.com/get/mysql84-community-release-el7-1.noarch.rpm
Last metadata expiration check: 5:19:02 ago on Sun 27 Oct 2024 05:36:20 PM CST.
mysql84-community-release-el7-1.noarch.rpm 6.4 kB/s | 11 kB 00:01
Dependencies resolved.
==============================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================
Installing:
mysql84-community-release noarch el7-1 @commandline 11 k
Transaction Summary
==============================================================================================================================================================================================================
Install 1 Package
Total size: 11 k
Installed size: 17 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mysql84-community-release-el7-1.noarch 1/1
Verifying : mysql84-community-release-el7-1.noarch 1/1
Installed:
mysql84-community-release-el7-1.noarch
Complete!然后执行 yum -y install mysql-community-server
~]# yum -y install mysql-community-server
Last metadata expiration check: 0:10:25 ago on Sun 27 Oct 2024 10:55:32 PM CST.
Dependencies resolved.
==============================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================
Installing:
mysql-community-server x86_64 8.4.3-1.el7 mysql-8.4-lts-community 61 M
Installing dependencies:
compat-openssl10 x86_64 1:1.0.2o-4.0.1.al8 alinux3-updates 1.1 M
mysql-community-client x86_64 8.4.3-1.el7 mysql-8.4-lts-community 15 M
mysql-community-client-plugins x86_64 8.4.3-1.el7 mysql-8.4-lts-community 3.5 M
mysql-community-common x86_64 8.4.3-1.el7 mysql-8.4-lts-community 689 k
mysql-community-icu-data-files x86_64 8.4.3-1.el7 mysql-8.4-lts-community 2.2 M
mysql-community-libs x86_64 8.4.3-1.el7 mysql-8.4-lts-community 1.5 M
Transaction Summary
==============================================================================================================================================================================================================
Install 7 Packages
Total download size: 85 M
Installed size: 390 M
Downloading Packages:
(1/7): compat-openssl10-1.0.2o-4.0.1.al8.x86_64.rpm 12 MB/s | 1.1 MB 00:00
(2/7): mysql-community-common-8.4.3-1.el7.x86_64.rpm 435 kB/s | 689 kB 00:01
(3/7): mysql-community-client-plugins-8.4.3-1.el7.x86_64.rpm 1.6 MB/s | 3.5 MB 00:02
(4/7): mysql-community-client-8.4.3-1.el7.x86_64.rpm 6.4 MB/s | 15 MB 00:02
(5/7): mysql-community-icu-data-files-8.4.3-1.el7.x86_64.rpm 2.7 MB/s | 2.2 MB 00:00
(6/7): mysql-community-libs-8.4.3-1.el7.x86_64.rpm 874 kB/s | 1.5 MB 00:01
(7/7): mysql-community-server-8.4.3-1.el7.x86_64.rpm 11 MB/s | 61 MB 00:05
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 10 MB/s | 85 MB 00:08
MySQL 8.4 LTS Community Server 3.0 MB/s | 3.1 kB 00:00
Importing GPG key 0xA8D3785C:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : compat-openssl10-1:1.0.2o-4.0.1.al8.x86_64 1/7
Running scriptlet: compat-openssl10-1:1.0.2o-4.0.1.al8.x86_64 1/7
Installing : mysql-community-client-plugins-8.4.3-1.el7.x86_64 2/7
Installing : mysql-community-common-8.4.3-1.el7.x86_64 3/7
Installing : mysql-community-libs-8.4.3-1.el7.x86_64 4/7
Running scriptlet: mysql-community-libs-8.4.3-1.el7.x86_64 4/7
Installing : mysql-community-client-8.4.3-1.el7.x86_64 5/7
Installing : mysql-community-icu-data-files-8.4.3-1.el7.x86_64 6/7
Running scriptlet: mysql-community-server-8.4.3-1.el7.x86_64 7/7
Installing : mysql-community-server-8.4.3-1.el7.x86_64 7/7
Running scriptlet: mysql-community-server-8.4.3-1.el7.x86_64 7/7
Verifying : compat-openssl10-1:1.0.2o-4.0.1.al8.x86_64 1/7
Verifying : mysql-community-client-8.4.3-1.el7.x86_64 2/7
Verifying : mysql-community-client-plugins-8.4.3-1.el7.x86_64 3/7
Verifying : mysql-community-common-8.4.3-1.el7.x86_64 4/7
Verifying : mysql-community-icu-data-files-8.4.3-1.el7.x86_64 5/7
Verifying : mysql-community-libs-8.4.3-1.el7.x86_64 6/7
Verifying : mysql-community-server-8.4.3-1.el7.x86_64 7/7
Installed:
compat-openssl10-1:1.0.2o-4.0.1.al8.x86_64 mysql-community-client-8.4.3-1.el7.x86_64 mysql-community-client-plugins-8.4.3-1.el7.x86_64 mysql-community-common-8.4.3-1.el7.x86_64
mysql-community-icu-data-files-8.4.3-1.el7.x86_64 mysql-community-libs-8.4.3-1.el7.x86_64 mysql-community-server-8.4.3-1.el7.x86_64
Complete!4、相关文件路径
配置文件在/etc/my.cnf目录下,查看内容(cat /etc/my.cnf)可以看到数据目录(/var/lib/mysql)、错误日志(log-error)等路径。
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid5、登陆并修改root密码
要得先启动服务。
# 启动
systemctl start mysqld
# 重启
systemctl restart mysqld
# 停止
systemctl stop mysqld查找启动时日志中记录的密码
etc]# cat /var/log/mysqld.log | grep password
2024-10-27T15:34:16.558422Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: n(5mXl(yoXVz在运行了systemctl start mysqld之后,运行mysql -u root -p 密码是上一步cat /var/log/mysqld.log | grep password 得到的密码:n(5mXl(yoXVz
mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)这种错误通常发生在以下几种情况下:
- 用户名或密码不正确。
- 用户没有足够的权限(例如,配置文件中的权限设置有误)。
- MySQL 服务没有正确配置。
- MySQL 配置文件与实际设置不匹配。
我这里是权限的问题,下面是解决方案
vim /etc/my.cnf文件,进入文件后按 insert 开始编辑。在[mysqld]后添加skip-grant-tables(登录时跳过权限检查),结束后输入:wq!
重启MySQL服务:sudo systemctl restart mysqld,然后无密码进入

先查询一下用户表情况
mysql> select user, host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)修改任意ip都能远程访问
mysql> update user set Host='%' where User='root';修改访问密码
ALTER USER 'root'@'%' IDENTIFIED BY '你需要设置的密码';刷新一下
mysql> flush privileges;这样就完成了密码的修改以及修改任意ip都能远程访问(注意:安全性降低了)
将之前/etc/my.cnf文件[mysqld]后添加的skip-grant-tables(登录时跳过权限检查)删除掉,结束后输入:wq!
然后再重启mysql服务 sudo systemctl restart mysqld
6、校验效果
[root@iZbp1fety7hsagj0jv6s5tZ ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@iZbp1fety7hsagj0jv6s5tZ ~]#
[root@iZbp1fety7hsagj0jv6s5tZ ~]#
[root@iZbp1fety7hsagj0jv6s5tZ ~]#
[root@iZbp1fety7hsagj0jv6s5tZ ~]#
[root@iZbp1fety7hsagj0jv6s5tZ ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.4.3 MySQL Community Server - GPL
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>不输入密码无法进入,输入密码成功进入
校验远程连接 
阿里云的安全组没开放此端口,我们将端口放行一下 

安装redis(如果已安装,则忽略这一步)
简介
Redis全称为Remote Dictionary Server(远程数据服务),是一款开源的基于内存的键值对存储系统,其主要被用作高性能缓存服务器使用,当然也可以作为消息中间件和Session共享等。Redis独特的键值对模型使之支持丰富的数据结构类型,即它的值可以是字符串、哈希、列表、集合、有序集合,而不像Memcached要求的键和值都是字符串。同时由于Redis是基于内存的方式,免去了磁盘I/O速度的影响,因此其读写性能极高。
安装
1、安装
~]# sudo yum install redis
alinux3-os 138 kB/s | 3.8 kB 00:00
alinux3-updates 171 kB/s | 4.1 kB 00:00
alinux3-module 290 kB/s | 4.2 kB 00:00
alinux3-plus 573 kB/s | 3.0 kB 00:00
alinux3-plus 77 MB/s | 27 MB 00:00
alinux3-powertools 124 kB/s | 3.0 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 260 kB/s | 4.4 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 57 MB/s | 14 MB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 119 kB/s | 3.0 kB 00:00
Dependencies resolved.
==============================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================
Installing:
redis x86_64 6.2.7-1.0.2.al8 alinux3-updates 1.2 M
Transaction Summary
==============================================================================================================================================================================================================
Install 1 Package
Total download size: 1.2 M
Installed size: 4.3 M
Is this ok [y/N]: y
Downloading Packages:
redis-6.2.7-1.0.2.al8.x86_64.rpm 17 MB/s | 1.2 MB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 17 MB/s | 1.2 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: redis-6.2.7-1.0.2.al8.x86_64 1/1
warning: Unable to get systemd shutdown inhibition lock: File exists
Installing : redis-6.2.7-1.0.2.al8.x86_64 1/1
Running scriptlet: redis-6.2.7-1.0.2.al8.x86_64 1/1
Verifying : redis-6.2.7-1.0.2.al8.x86_64 1/1
Installed:
redis-6.2.7-1.0.2.al8.x86_64
Complete!2、设置配置文件
vim redis.conf
2.1、设置后台启动
daemonize no修改为daemonize yes即可
2.2、开启远程访问
- 注释 bind 127.0.0.1
- 将protected-mode改为no
2.3、设置密码
requirepass 你的密码
2.4、启动服务
etc]# /bin/redis-server /etc/redis.conf2.5、三方连接工具验证

安装nginx
简介
nginx(engine x) 是一个高性能的HTTP 和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。
安装
~]# yum install -y nginx设置开机启动
sudo systemctl enable nginx启动服务
sudo systemctl start nginx停止服务
sudo systemctl restart nginx重新加载,因为一般重新配置之后,不希望重启服务,这时可以使用重新加载。
sudo systemctl reload nginx安装Java
安装JDK
首先输入以下命令,查看当前服务器可以通过yum下载哪些jdk
yum search jdk选择好你想安装的JDK版本,推荐1.8以上,要不好多项目无法运行(JDK1.8的改动有点大),输入以下命令:
yum -y install java-1.8.0-openjdk*安装好后查看安装的版本
app]# java -version
openjdk version "1.8.0_432"
OpenJDK Runtime Environment (build 1.8.0_432-b06)
OpenJDK 64-Bit Server VM (build 25.432-b06, mixed mode)启动服务程序
码云下载程序圣钰SaaS,各位帅哥靓妹烦请Star 并关注下该项目
启动后台
先修改MySQL、redis等配置信息
启动 
启动前端,前端基于Vue3 + element-plus
# 安装 pnpm,提升依赖的安装速度
npm config set registry https://registry.npmmirror.com
npm install -g pnpm
# 安装依赖
pnpm install
# 启动服务
npm run fornt支持平台端和租户端同时启动,同时兼容两套完全独立的平台端和租户端 
项目简要说明图
