Linux 安装 MySQL RPM

RPM安装MySQL

Centos7.6 + MySQL5.7.34
下载地址:https://dev.mysql.com/downloads/mysql/

# 清理环境
rpm -qa |grep -i mysql
rpm -qa |grep -i mariadb

# 普通删除模式
rpm -e mysql
# 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
rpm -e --nodeps mysql
rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64

# 安装 mysql5.7 所需要的依赖
yum install -y libaio
yum install -y perl-JSON
yum install -y net-tools
# RPM 套件
wget -c https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.34-1.el7.x86_64.rpm-bundle.tar
tar xvf mysql-5.7.34-1.el7.x86_64.rpm-bundle.tar

# 安装
rpm -ivh mysql-community-*.rpm

安装后一些文件的路径

basedir=/usr/share/mysql
datadir=/var/lib/mysql
log-error=/var/log/mysqld.log
socket=/var/lib/mysql/mysql.sock
pid-file=/var/run/mysqld/mysqld.pid

# 配置文件位置,多个有优先级
/etc/my.cnf
# 启动MySQL服务
systemctl start mysqld.service
ps -ef | grep mysql

# 查看初始密码
cat /var/log/mysqld.log | grep password

# 登录并修改密码
mysql -u root -p
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘password‘;

# 开启远程访问
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘password‘ with grant option;
flush privileges;

Linux 安装 MySQL RPM

上一篇:52 接口开发、服务器的基本配置、宝塔面板配置、上传数据库、上传接口源代码、部署静态页面网站


下一篇:06 Spark SQL 及其DataFrame的基本操作