欢迎投稿

今日深度:

centos7.4安装mysql8.0,centos7.4mysql8.0

centos7.4安装mysql8.0,centos7.4mysql8.0


1. 卸载mariadb

yum list installed | grep mariadb    #检查mariadb是否已安装

yum -y remove mariadb*    #全部卸载

2. 下载安装mysql的yum源

wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm  #mysql官网查询获取最新的版本,下载

yum localinstall mysql80-community-release-el7-1.noarch.rpm #安装

3. 安装mysql

yum repolist enabled | grep 'mysql' #查看可用MySQL版本

结果:

mysql-connectors-community/x86_64 MySQL Connectors Community                 
mysql-tools-community/x86_64      MySQL Tools Community                      
mysql80-community/x86_64          MySQL 8.0 Community Server
yum install mysql-community-server #安装,一路yes

4.初始化密码

service mysqld start #启动服务
service mysqld stop  #停止服务

grep 'password' /var/log/mysqld.log #获取初始密码

输出:

2018-08-25T08:41:25.794174Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: u7kcohhUu?jY

root账号初始密码为:u7kcohhUu?jY ,启动msyql服务,使用root账号登陆

service mysqld start 

mysql -u root -p  #输入密码登陆

#设置新密码
alter user'root'@'localhost' IDENTIFIED BY 'newPassword!';

5.新建数据库,添加远程连接账号

#使用root账号登陆,验证新密码,略

#创建数据库
create database test

#新建用户
create user 'testuser'@'%' identified by 'Test123!';

#授权
grant all on test.* to 'testuser'@'%';

6.其他

  • mysql 8.0版本更改了加密规则,密码需要包括数字、字符、符号,navicat会连接不上,查阅资料可解决
  • 以下设置密码语句会报错
set password for 'root'@'localhost'=password('newPassword!');

www.htsjk.Com true http://www.htsjk.com/mariadb/25939.html NewsArticle centos7.4安装mysql8.0,centos7.4mysql8.0 1. 卸载mariadb yum list installed | grep mariadb #检查mariadb是否已安装 yum -y remove mariadb* #全部卸载 2. 下载安装mysql的yum源 wget https://repo .mysql .com //mysql80-communit...
相关文章
    暂无相关文章
评论暂时关闭