MySQL的安装
# 配置 mysql 的 yum 源
选择 yum 源: yum 源 (opens new window),点击下载合适的版本
上传到 Linux 系统中 使用 rzsz 工具将文件上传到 Linux 系统
安装 rpm
rpm -ivh mysqlxxx.rpm # 文件名
1
# 安装 MySQL 服务
- 安装
yum install mysql-community-server
1
- 检验安装的成功
ls /etc/my.cnf
which mysqld
which mysql
1
2
3
4
5
2
3
4
5
# 登录 MySQL
初次登陆使用 MySQL 的临时密码:
grep 'temporary password' /var/log/mysqld.log
1
登录之后,设置新密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
1
后续使用新密码登录即可:
mysql -u root -p
1
# 卸载环境
- 关闭 MySQL 运行:
systemctl stop mysqld
1
- 查找 MySQL 相关安装包
rpm -qa | grep mysql
1
- 卸载上述安装包
rpm -qa | grep mysql | xargs yum remove
1
上次更新: 2026/03/20, 11:19:56