mysql 安装

1.安装方式

1.二进制安装
2.源码包安装
3.rpm包安装

1.二进制安装

1)上传或者下载包

[root@db01 ~]# rz
#或者
[root@web01 ~]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz

2)安装依赖

先安装依耐,在解压之前安装,防止包在解压的时候就去找依耐,而出现安装报错的问题。

[root@db01 ~]# yum install -y ncurses-devel libaio-devel autoconf

3)解压包

[root@db01 ~]# tar xf mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz

4)移动目录

一般用户安装的软件放在/usr/local/下面

[root@db01 ~]# mv mysql-5.6.46-linux-glibc2.12-x86_64 /usr/local/

主文件夹下的一些目录

[root@db01 /usr/local/mysql-5.6.46-linux-glibc2.12-x86_64]# ll
total 240
drwxr-xr-x 2 root root 4096 Jul 9 10:33 bin # 存放的二进制文件,比如启动文件在里面
drwxr-xr-x 3 root root 18 Jul 9 10:34 data
drwxr-xr-x 2 root root 55 Jul 9 10:33 docs
drwxr-xr-x 3 root root 4096 Jul 9 10:34 include
drwxr-xr-x 3 root root 316 Jul 9 10:33 lib
-rw-r--r-- 1 7161 31415 221739 Sep 27 2019 LICENSE
drwxr-xr-x 4 root root 30 Jul 9 10:33 man
drwxr-xr-x 10 root root 291 Jul 9 10:34 mysql-test # 存放默认的数据库
-rw-r--r-- 1 7161 31415 587 Sep 27 2019 README
drwxr-xr-x 2 root root 30 Jul 9 10:33 scripts
drwxr-xr-x 28 root root 4096 Jul 9 10:34 share
drwxr-xr-x 4 root root 4096 Jul 9 10:34 sql-bench
drwxr-xr-x 2 root root 136 Jul 9 10:34 support-files # 里面有默认的配置文件和启动脚本

5)做软连接

方便升级和管理目录

[root@db01 ~]# ln -s /usr/local/mysql-5.6.46-linux-glibc2.12-x86_64 /usr/local/mysql

6)创建mysql用户

用来管理mysql进程的

[root@db01 ~]# useradd mysql -s /sbin/nologin -M

7)拷贝配置文件和启动脚本

[root@db01 ~]# cd /usr/local/mysql/support-files/
[root@db01 support-files]# cp my-default.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? y [root@db01 support-files]# cp mysql.server /etc/init.d/mysqld

8)初始化数据库

[root@db01 ~]# cd /usr/local/mysql/scripts/
[root@db01 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user: 指定用户
--basedir: 指定安装目录
--datadir: 指定数据目录 #初始化成功的标志是两个ok

9)启动数据库

[root@db01 scripts]# /etc/init.d/mysqld start

10)配置环境变量

[root@db01 scripts]# vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH [root@db01 scripts]# source /etc/profile

11)配置system管理mysql

[root@db01 scripts]# vim /usr/lib/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000 [root@db01 scripts]# systemctl daemon-reload
[root@db01 scripts]# systemctl start mysqld

12)确认启动

[root@db01 scripts]# ps -ef | grep mysql
mysql 12886 1 2 03:10 ? 00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
root 12921 10636 0 03:11 pts/1 00:00:00 grep --color=auto mysql
[root@db01 scripts]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 12027/redis-server
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 6180/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7113/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 7198/master
tcp6 0 0 :::3306 :::* LISTEN 12886/mysqld
tcp6 0 0 :::111 :::* LISTEN 6180/rpcbind
tcp6 0 0 :::22 :::* LISTEN 7113/sshd
tcp6 0 0 ::1:25 :::* LISTEN 7198/master # 安装成功
[root@db01 scripts]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.46 MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

遇到的报错

[root@db01 /usr/local/mysql-5.6.46-linux-glibc2.12-x86_64/scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
FATAL ERROR: please install the following Perl modules before executing ./mysql_install_db:
Data::Dumper # 解决命令
yum -y install autoconf
FBI WARNING
QQ:1402122292 认准原创sheldon 别人叫我晓东
欢迎访问个人站点:shelldon.51vip.biz

Mysql_二进制方式安装详解的更多相关文章

  1. Elasticsearch-2.4.3的3节点安装(多种方式图文详解)(含 head、kopf、marvel、shield和watcher插件安装和使用)

    前提: Elasticsearch-2.4.3的下载(图文详解) Elasticsearch-2.4.3的单节点安装(多种方式图文详解) 我这里,以192.168.80.10(HadoopMaster ...

  2. Linux ssh登录和软件安装详解

    阿哲Style   Linux第一天 ssh登录和软件安装详解 Linux学习第一天 操作环境: Ubuntu 16.04 Win10系统,使用putty_V0.63 本身学习Linux就是想在服务器 ...

  3. Oracle Database 12c Release 2安装详解

    第1章 Oracle Database 12c Release 2安装详解 1.1 下载方法 oracle官网https://www.oracle.com 1)打开官方网站,找到下载连接 2)选择更多 ...

  4. Hadoop 发行版本 Hortonworks 安装详解(一) 准备工作

    一.前言 目前Hadoop发行版非常多,所有这些发行版均是基于Apache Hadoop衍生出来的,之所以有这么多的版本,完全是由Apache Hadoop的开源协议决定的:任何人可以对其进行修改,并 ...

  5. CentOS 7的安装详解

    不多说,直接上干货! CentOS 6.5的安装详解 主流:  目前的Linux操作系统主要应用于生产环境, 主流企业级Linux系统仍旧是RedHat或者CentOS. 免费: RedHat 和Ce ...

  6. Nginx的介绍和安装详解

    [介绍+安装]Nginx的介绍和安装详解   == 介绍和安装 == Nginx是一个自由.开源.高性能及轻量级的HTTP服务器及反转代理服务器, 其性能与IMAP/POP3代理服务器相当.Nginx ...

  7. sublime text 3 build 3143 安装详解

    sublime text 3 build 3143 安装详解   环境:ubuntu 16 (x64) 0x00 下载   官网下载地址   下载的文件是个压缩包,笔者解压之后将整个sublime-t ...

  8. IntelliJ IDEA(2018)安装详解

    转: IntelliJ IDEA(2018)安装详解 置顶 2018年06月06日 22:58:45 Lazymanx 阅读数:95701   版权声明: https://blog.csdn.net/ ...

  9. python3+requests:post请求四种传送正文方式(详解)

    前言:post请求我在python接口自动化2-发送post请求详解(二)已经讲过一部分了,主要是发送一些较长的数据,还有就是数据比较安全等,可以参考Get,Post请求方式经典详解进行学习一下. 我 ...

随机推荐

  1. sunny图表——NABCD分析

    项目 内容 这个作业属于哪个课程 2021春季计算机学院软件工程(罗杰 任健) 这个作业的要求在哪里 团队选题 我在这个课程的目标是 初步获得软件工程师的能力 这个作业在哪个具体方面帮助我实现目标 选 ...

  2. OO第四单元总结及学期总结

    目录 OO第四单元总结及学期总结 第四单元三次作业架构设计 第十三次作业 第十四次作业 第十五次作业 四个单元中架构设计及OO方法理解的演进 第一单元 第二单元 第三单元 第四单元 四个单元中测试理解 ...

  3. day19.进程通信与线程1

    1 进程Queue介绍 1 进程间数据隔离,两个进程进行通信,借助于Queue 2 进程间通信:IPC -借助于Queue实现进程间通信 -借助于文件 -借助于数据库 -借助于消息队列:rabbitm ...

  4. Day07_35_Colection下的方法

    Collection 下的方法 * **Collection 集合的方法应用** ``` package com.shige.Collection; import java.util.ArrayLis ...

  5. 【Spring】SpringIoC大致流程

    目录 SpringIoC 是什么? 类图 大致过程 源码分析 SpringIoC 是什么? ​ 官方文档的解释是:IoC也称为依赖注入(DI).在此过程中,对象仅通过构造函数参数,工厂方法的参数或在构 ...

  6. 同事写了一个疯狂的类构造器,我要疯了,Builder 模式都不会么?!

    疯狂的类构造器 最近栈长在做 Code Review 时,发现一段创建对象的方法: Task task = new Task(112, "紧急任务", "处理一下这个任务 ...

  7. [VSC] HTML打叹号无法自动提示默认框架

    一般的, 在 VSC 中编辑 HTML 文档时, 打一个叹号 '!', 就会提示, 可生成默认代码, 如: 采纳建议后, 是这样: 问题: 如果出现打叹号无法出现提示的情况, 首先, 请检查当前的语言 ...

  8. 02- HTML网页基础知识与浏览器介绍

    1.认识网页 网页主要由文字,图像和超链接等元素构成.当然,除了这些元素,网页还可以包含音频,视频,以及flask等. 如图所示就是一个网页: 网页是如何形成的呢? 它是由前端人员写的代码,经过浏览器 ...

  9. 【golang】golang中结构体的初始化方法(new方法)

    准备工作: 定义结构体:Student import ( "fmt" "reflect") type Student struct { StudentId st ...

  10. Python模块化编程

    目录 模块化 自定义模块 模块的内置属性 导入模块 安装第三方模块 查看模块的属性和方法 模块化 在Python中,一个.py文件就称之为一个模块(Module),为了避免模块名冲突,Python又引 ...