RedHat8 安装Mysql

一、安装mysql

1.yum源安装

  1. 配置yum,下载阿里的repo

wget http://mirrors.aliyun.com/repo/Centos-8.repo
  1. 查看mysql相关可用包

yum list mysql*
  1. 安装mysql

yum -y install mysql-devel.x86_64 
yum -y install mysql-server.x86_64
  1. 查看已安装的包

yum list installed mysql*

2.安装包安装

  1. 在mysql官网下载对应版本安装包https://downloads.mysql.com/archives/community/

  1. 通过ftp传输mysql安装包

  1. 创建目录并解压

mkdir mysql
tar -xvf mysqlxxx.tar
  1. 安装mysql

rpm -ivh mysql-community-common-xxx.rpm
rpm -ivh mysql-community-client-plugins-xxx.rpm
rpm -ivh mysql-community-libs-xxx.rpm
rpm -ivh mysql-community-libs-compat-xxx.rpm
yum install openssl-devel
rpm -ivh mysql-community-devel-xxx.rpm
rpm -ivh mysql-community-client-xxx.rpm
rpm -ivh mysql-community-server-xxx.rpm
  1. 查询自动生成root用户的密码

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

二、配置mysql

  1. 配置mysql-conf

vim /etc/my.cnf.d/mysql-server.cnf
  1. 配置字符格式及引擎

[mysqld]
character_set_server=utf8
default-storage-engine=INNODB

三、相关服务操作

  1. 启动mysql服务

service mysqld start
systemctl start mysqld
systemctl restart mysqld
systemctl stop mysqld

四、mysql相关操作

  1. 登录mysql

mysql -u root -p
  1. 更改密码

alter user 'root'@'localhost' identified by '123456';

指向上述语句可能会报错,可以降低密码校验规则

set global validate_password.policy = 0;
set global validate_password.length = 4;

五、Navicat连接阿里云上部署的mysql

  1. 创建用户用于远程访问,并给root用户赋权

create user 'root'@'%' identified with mysql_native_password by '123456';
grant all on *.* to 'root'@'%';
  1. 阿里云上设置mysql3306端口开放

  1. 为root账号赋权

update user set Host='%' where User='root';

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值