1. 准备一台Linux服务器
云服务器或者虚拟机都可以;
2. 下载Linux版MySQL安装包
3. 上传MySQL安装包
用FinalShell直接上传(下载好FinalShell 连接上服务器 直接把下载好的压缩包 拖进来就好)
4. 创建目录,并解压
mkdir mysql
tar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar -C mysql
5. 安装mysql的安装包
cd mysql
rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.26-1.el7.x86_64.rpm
yum install openssl-devel
rpm -ivh mysql-community-devel-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm
(用rpm指令 安装 如果缺少哪个依赖 就直接 yum install ......)
6. 启动MySQL服务
systemctl start mysqld
7. 查询自动生成的root用户密码
因为安装过程没有更改密码 所以要去日志文件里找默认密码
grep 'temporary password' /var/log/mysqld.log
找到后登录
mysql -u root -p