欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

1.mysql数据库-8.0.20版本安装

程序员文章站 2022-06-26 14:41:07
MySQL 分支OraclePerconaMariadbRDSTXMySQL 企业版本选择5.7 : 5.7.28+8.0 : 8.0.18+GA 6-12月版本,GA15-20版本以上的.获取软件https://downloads.mysql.com/archives/community/安装MySQL 8.0.204.1 准备操作系统环境略4.2 上传和解压[root@db01 opt]# tar xf mysql-8.0.20-linux-glibc.....
  1. MySQL 分支
    Oracle
    Percona
    Mariadb
    RDS
    TX

  2. MySQL 企业版本选择
    5.7 : 5.7.28+
    8.0 : 8.0.18+

GA 6-12月版本,GA15-20版本以上的.

  1. 获取软件
    https://downloads.mysql.com/archives/community/

  2. 安装MySQL 8.0.20
    4.1 准备操作系统环境

    4.2 上传和解压
    [root@db01 opt]# tar xf mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
    [root@db01 opt]# ln -s /opt/mysql-8.0.20-linux-glibc2.12-x86_64 /usr/local/mysql
    [root@db01 mysql]# vim /etc/profile
    export PATH=/usr/local/mysql/bin:$PATH
    [root@db01 mysql]# source /etc/profile
    [root@db01 mysql]# mysql -V
    mysql Ver 8.0.20 for Linux on x86_64 (MySQL Community Server - GPL)

4.3 卸载无用软件
[root@db01 ~]# yum remove -y mariadb-libs

4.4 创建用户
[root@db01 ~]# useradd mysql

4.5 创建目录并授权
[root@db01 ~]# mkdir -p /data/3306/data
[root@db01 ~]# chown -R mysql. /data

4.6 准备配置文件
[root@db01 ~]# vim /etc/my.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/data/3306/data
socket=/tmp/mysql.sock
[mysql]
socket=/tmp/mysql.sock

4.7 初始化MySQL系统数据
[root@db01 mysql]# yum install -y libaio-devel
[root@db01 mysql]# mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/3306/data

++++++++++++++++++++++++
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
2020-12-14T10:25:50.587761Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
++++++++++++++++++++++++

正确的输出:
[root@db01 mysql]# mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/3306/data
2020-12-14T10:27:26.083747Z 0 [System] [MY-013169] [Server] /opt/mysql-8.0.20-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.20) initializing of server in progress as process 2205
2020-12-14T10:27:26.176690Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-14T10:27:31.329930Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-14T10:27:34.098237Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
[root@db01 mysql]#

4.8 准备启动脚本
[root@db01 support-files]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

sys-v :
[root@db01 support-files]# service mysqld restart
Shutting down MySQL… SUCCESS!
Starting MySQL… SUCCESS!
[root@db01 support-files]#

systemd:
[root@db01 support-files]# systemctl enable mysqld
mysqld.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld on
[root@db01 support-files]#

[root@db01 support-files]# systemctl restart mysqld
[root@db01 support-files]# systemctl stop mysqld

本文地址:https://blog.csdn.net/xiaoleinb/article/details/111997564

相关标签: mysql