暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

安装MySQL8

1238

  • Linux版本:CentOS7.6

  • MySQL版本:8.0.13

1、下载MySQL8

  1. 下载地址:https://downloads.mysql.com/archives/community/

  2. 选择版本和系统版本,然后Download。

    下载安装包

2、安装MySQL8

  1. 登陆root用户。

  2. 上传安装包到服务器(或者可以在服务器直接使用wget命令进行下载),并解压。

  3. 卸载mariadb,会与MySQL安装冲突。

    • rpm -qa | grep mariadb查看有无mariadb

    • 如果有则删除yum -y remove mariadb-libs.x86_64

  4. 安装numactl

    • yum list installed|grep numactl

    • 如果没有则yum install numactl,否则会在安装时报错

error:

Failed dependencies:

libnuma.so.1()(64bit) is needed by mysql-community-server-8.0.13-1.el7.x86_64

libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-8.0.13-1.el7.x86_64

libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-8.0.13-1.el7.x86_64

1


  1. 解压tar -xvf mysql-8.0.13-1.el7.x86_64.rpm-bundle.tar

  2. 安装4个必须安装的包(需要按顺序安装)。

rpm -ivh mysql-community-common-8.0.13-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-8.0.13-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-8.0.13-1.el7.x86_64.rpm

rpm -ivh mysql-community-server-8.0.13-1.el7.x86_64.rpm


  1. 安装另外4个非必须包(需要按顺序安装也可以不装跳过此步骤)。

rpm -ivh mysql-community-libs-compat-8.0.13-1.el7.x86_64.rpm

rpm -ivh mysql-community-embedded-compat-8.0.13-1.el7.x86_64.rpm

rpm -ivh mysql-community-devel-8.0.13-1.el7.x86_64.rpm

rpm -ivh mysql-community-test-8.0.13-1.el7.x86_64.rpm


  1. 启动service mysqld start并查看状态service mysqld status

3、登陆MySQL8

  1. 查看临时密码cat var/log/mysqld.log

    查看临时密码

  2. 使用临时密码登陆并修改密码。

    • mysql -u root -p回车输入临时密码。

    • alter USER 'root'@'localhost' IDENTIFIED BY '新密码(必须包含:数字大小写字母特殊字符)';

  3. 修改MySQL的root用户远程可以登陆

    • use mysql;

    • select host, user from user;

    • 如果hostlocalhost则执行update user set host = "%" where user='root';

    • 刷新生效flush privileges;

  4. 解决部分客户端无法连接的问题,比如dbvisualizer

    Unable to load authentication plugin 'caching_sha2_password

    • mysql -u root -p回车输入密码。

    • alter USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root用户的密码';

    • 刷新生效flush privileges;


最后修改时间:2020-05-09 09:25:22
文章转载自数据库平台优化,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论