码迷,mamicode.com
首页 > 数据库 > 详细

mysql数据库安装

时间:2021-01-22 11:42:50      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:soc   yum   start   系统数据   created   exp   conf   mariadb   The   

MySQL的介绍和安装

  1. MySQL 分支
    Oracle
    Percona
    Mariadb
    RDS
    TX

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

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

下载路径

https://downloads.mysql.com/archives/community/

4. 安装MySQL 8.0.20

上传和解压

[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 
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

mysql数据库安装

标签:soc   yum   start   系统数据   created   exp   conf   mariadb   The   

原文地址:https://www.cnblogs.com/ruirui-com/p/14306569.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!