【个人用户简易完整版】
1. 下载
进入官网下载8.0.28版本 MySQL下载
2. 安装
2.1 将压缩包上传到Linux
2.2 解压后按以下顺序进行安装
1. rpm -ivh mysql-community-common
2. rpm -ivh mysql-community-client-plugins
3. rpm -ivh mysql-community-libs
4. rpm -ivh mysql-community-client
5. rpm -ivh mysql-community-icu-data-files
6. rpm -ivh mysql-community-server
2.3 执行初始化命令
mysqld --initialize --console
2.4 设置某个目录的用户和用户组权限:
chown -R mysql:mysql /var/lib/mysql/
2.5 查看临时密码:
cat /var/log/mysqld.log | grep localhost
2.6 启动MySQL服务:
systemctl start mysqld
2.7 使用临时密码登录MySQL:
mysql -uroot -pPASSWORD
2.8 修改密码:
alter user 'root'@'localhost' identified by '1234';
2.9 使用新密码登录
mysql -uroot -p1234
2.10 安装成功!!!
安装问题总汇
有其余问题请在评论区留言,我会加更到文章最后供大家参考
-
安装mysql-community-server时报错
警告:mysql-community-server-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
错误:依赖检测失败:
libaio.so.1()(64bit) 被 mysql-community-server-8.0.28-1.el7.x86_64 需要
libaio.so.1(LIBAIO_0.1)(64bit) 被 mysql-community-server-8.0.28-1.el7.x86_64 需要
libaio.so.1(LIBAIO_0.4)(64bit) 被 mysql-community-server-8.0.28-1.el7.x86_64 需要解决方案:
rpm -qa | grep libaio //查询libaio包 yum -y install libaio //安装libaio包
警告:mysql-community-server-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
错误:依赖检测失败:
/usr/bin/perl 被 mysql-community-server-8.0.28-1.el7.x86_64 需要
perl(Getopt::Long) 被 mysql-community-server-8.0.28-1.el7.x86_64 需要
perl(strict) 被 mysql-community-server-8.0.28-1.el7.x86_64 需要解决方案:
yum install -y perl 安装perl之后 再安装server包
-
启动MySQL的时候报错
Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.
解决方案:
首先执行 cat /var/log/mysqld.log 查看报错原因 如果原因是 Table 'mysql.plugin' doesn't exist 1. 执行 rm -rf /var/lib/mysql 2. 执行 service mysqld restart 3. 执行 systemctl start mysqld 解决