Centos7 安装 Mysql5.7.33 步骤

1.下载安装包(5.7.33 Red Hat Linux版)

地址:https://downloads.mysql.com/archives/community/

文件:

mysql-community-server-5.7.33-1.el7.x86_64.rpm
mysql-community-client-5.7.33-1.el7.x86_64.rpm
mysql-community-common-5.7.33-1.el7.x86_64.rpm
mysql-community-libs-5.7.33-1.el7.x86_64.rpm

2.卸载mariadb

1)查看是否默认安装

rpm -qa | grep mariadb

2)卸载第一步中查出来的文件

rpm -e mariadb-libs-5.5.65-1.el7.x86_64 --nodeps

3.安装依赖

yum install libaio -y
yum install net-tools -y

4.安装MYSQL

rpm -ivh mysql-community-common-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.33-1.el7.x86_64.rpm 
rpm -ivh mysql-community-client-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.33-1.el7.x86_64.rpm

5.启动MYSQL

1)查看启动状态

systemctl status mysqld

2)启动

systemctl start mysqld

3)重启

systemctl restart mysqld

4)停止

systemctl stop mysqld

6.登录MYSQL

1)找密码(在日志里)

grep 'temporary password' /var/log/mysqld.log

2)登录

mysql -u root -p

3)重置密码

ALTER USER 'root'@'localhost' IDENTIFIED BY '!@#qwe456';

4)设置远程访问

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '!@#qwe456';
flush privileges;

7.配置MYSQL

vim /etc/my.cnf

[client]

default-character-set=utf8mb4

[mysqld]

port=3306

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

open_files_limit=65535

slow_query_log=on
long_query_time=10
slow_query_log_file=/var/log/mysql/slow_query.log
log-queries-not-using-indexes=1

default_storage_engine=InnoDB
innodb_file_per_table=on

innodb_buffer_pool_size=1G

skip_name_resolve=on

lower_case_table_names=0

character-set-server=utf8mb4

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

8.重启MYSQL

systemctl restart mysqld

9.设置开机启动

systemctl enable mysqld.service

10.关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值