centos7安装mysql8.0

centos7安装mysql8.0

在MySQL官网下载YUM源rpm安装包(mysql80-community-release-el7-1.noarch.rpm)
安装源安装包

 sudo yum localinstall mysql80-community-release-el7-1.noarch.rpm

检查mysql源是否安装成功
这里写图片描述
查看可安装的版本命令

yum repolist all | grep mysql

安装最新版本的mysql

sudo yum install mysql-community-server

启动mysql

sudo service mysqld start

查看mysql状态

sudo service mysqld status

开机启动

systemctl enable mysqld
systemctl daemon-reload

修改root默认密码

grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; 

配置默认编码为UTF-8
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置

[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'

你可能感兴趣的:(数据库)