centos7下rpm安装mysql
# 下载安装包
wget https://mirrors.cloud.tencent.com/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-client-5.7.35-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-common-5.7.35-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-devel-5.7.35-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-libs-5.7.35-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-server-5.7.35-1.el7.x86_64.rpm
1
2
3
4
5
2
3
4
5
# 卸载mariadb
rpm -qa | grep mariadb
rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
1
2
3
2
3
# 按顺序安装
yum install mysql-community-common-5.7.35-1.el7.x86_64.rpm -y
yum install mysql-community-libs-5.7.35-1.el7.x86_64.rpm -y
yum install mysql-community-devel-5.7.35-1.el7.x86_64.rpm -y
yum install mysql-community-client-5.7.35-1.el7.x86_64.rpm -y
yum install mysql-community-server-5.7.35-1.el7.x86_64.rpm -y
# 配置数据目录
vi /etc/my.cnf
#数据目录
datadir=/data/database/mysql
#开启binlog
server-id=1
log_bin=/data/database/mysql/binlog/mysql-bin
#不区分大小写
lower_case_table_names=1
#设置字符集
character-set-server=utf8mb4
# 最大连接数.
max_connections=2048
# 打开的文件描述符限制.
open_files_limit=65535
group_concat_max_len = 102400
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 启动服务并修改root密码
#启动服务
systemctl start mysqld
#查看密码
grep 'temporary password' /var/log/mysqld.log
2023-06-21T08:40:31.470093Z 1 [Note] A temporary password is generated for root@localhost: VlVSj#4C1HyD
#登录
mysql -uroot -p
#修改密码
alter user 'root'@'localhost' identified by 'fasG344_32dsf';
#修改root账号具有远程连接权限
grant all on *.* to root@'%' identified by 'fasG344_32dsf' with grant option;
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
上次更新: 2023/06/25, 16:58:02