1. 下载 mysql 安装包

    $ wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.44.tar.gz
    # or
    $ curl -O https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.44.tar.gz
  2. 解压

    $ tar -zxvf mysql-5.6.44.tar.gz
    $ cd mysql-5.6.44
  3. 配置 mysql 用户

    $ groupadd mysql
    $ useradd -g mysql -s /sbin/nologin -M mysql
  4. 安装前置扩展

    $ yum -y install gcc gcc-c++ make cmake ncurses-devel bison libaio autoconf
  5. 编译和安装 「参数详情:点我查看

    $ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci  -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1
    $ make && make install
    # 没有太大的原因这里应该会成功的
  6. 配置和运行

    • 配置 mysql 启动文件

      $ cd /usr/local/mysql
      $ cp support-files/mysql.server /etc/init.d/mysqld
      $ cp support-files/my-default.cnf /etc/my.cnf
      $ cd scripts
      $ ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/
    • 配置系统变量

      $ echo "PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile

$ source /etc/profile

```

  • 修改默认的 /etc/my.cnf

    [mysqld]
    
    user = mysql
    port = 3306
    socket = /tmp/mysql.sock
    basedir = /usr/local/mysql
    datadir = /usr/local/mysql/data
    open_files_limit = 10240 [mysqld_safe]
    log-error=/usr/local/mysql/data/mysql_oldboy.err
    pid-file=/usr/local/mysql/data/mysqld.pid sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
  • 启动

    # 启动 mysql
    $ service mysqld start
  • 设置root密码

    $ mysql_secure_installation
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
    SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current
    password for the root user. If you've just installed MySQL, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here. Enter current password for root (enter for none):
    OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL
    root user without the proper authorisation.
    # 设置 root 密码
    Set root password? [Y/n] Y
    New password:
    Re-enter new password:
    Password updated successfully!
    Reloading privilege tables..
    ... Success! By default, a MySQL installation has an anonymous user, allowing anyone
    to log into MySQL without having to have a user account created for
    them. This is intended only for testing, and to make the installation
    go a bit smoother. You should remove them before moving into a
    production environment.
    # 删除 匿名用户
    Remove anonymous users? [Y/n] Y
    ... Success! Normally, root should only be allowed to connect from 'localhost'. This
    ensures that someone cannot guess at the root password from the network.
    # 设置 root 只能来自本机登录
    Disallow root login remotely? [Y/n] Y
    ... Success! By default, MySQL comes with a database named 'test' that anyone can
    access. This is also intended only for testing, and should be removed
    before moving into a production environment.
    # 删除测试数据库
    Remove test database and access to it? [Y/n] Y
    - Dropping test database...
    ... Success!
    - Removing privileges on test database...
    ... Success! Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    # 重新加载配置
    Reload privilege tables now? [Y/n] Y
    ... Success! All done! If you've completed all of the above steps, your MySQL
    installation should now be secure. Thanks for using MySQL! Cleaning up...
  • 设置开机自启动

    $ /sbin/chkconfig mysqld on

完成所有的安装和启动,重启一下试试 mysql 是否能正常自动启动。如果可以 mysql 就安装完成了

centos 7 源码安装 mysql 5.6的更多相关文章

  1. CentOS下源码安装MySQL

    一.创建mysql用户与组,相关目录 useradd mysql -s /sbin/nologin mkdir /usr/local/mysql chown -R mysql.mysql mkdir ...

  2. centos 6x系统下源码安装mysql操作记录

    在运维工作中经常部署各种运维环境,涉及mysql数据库的安装也是时常需要的.mysql数据库安装可以选择yum在线安装,但是这种安装的mysql一般是系统自带的,版本方面可能跟需求不太匹配.可以通过源 ...

  3. CentOS 7下源码安装MySQL 5.7

    网上说linux安装mysql服务分两种安装方法: ①源码安装,优点是安装包比较小,只有几十M左右,缺点是安装依赖的库多,安装编译时间长,安装步骤复杂容易出错: ②使用官方编译好的二进制文件安装,优点 ...

  4. CentOS 6.4 源码安装MySQL 5.6

    1.安装前准备工作 1.1 必备的包 gcc/g++ :MySQL 5.6开始,需要使用g++进行编译.cmake :MySQL 5.5开始,使用cmake进行工程管理,cmake需要2.8以上版本. ...

  5. Centos7源码安装mysql及读写分离,互为主从

       Linux服务器 -源码安装mysql 及读写分离,互为主从   一.环境介绍: Linux版本: CentOS 7 64位 mysq版本: mysql-5.6.26 这是我安装时所使用的版本, ...

  6. CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5

    一.准备(把所有的源文件放在‘/home/yuanjun’目录下) apr http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz apr-util ...

  7. lnux下源码安装MySQL 5.6

    nux下源码安装MySQL 5.6 说明:本文是我自己测试的MySQL5.6源码安装,经本人亲自实践,完全可用,另在5.6之前的版本也是可以按照本文源码安装的.我是在两台linux下一台安装5.5,另 ...

  8. Linux平台下源码安装mysql多实例数据库

    Linux平台下源码安装mysql多实例数据库[root@linux-node1 ~]# netstat -tlunp | grep 330tcp6 0 0 :::3306 :::* LISTEN 6 ...

  9. 源码安装mysql,及主从同步

    源码安装mysql [可选] 如果用源码安装cmake软件: cd /home/oldboy/tools/ tar xf cmake-.tar.gz cd cmake- ./configure #CM ...

随机推荐

  1. AcWing:144. 最长异或值路径(dfs + 01字典树)

    给定一个树,树上的边都具有权值. 树中一条路径的异或长度被定义为路径上所有边的权值的异或和: ⊕ 为异或符号. 给定上述的具有n个节点的树,你能找到异或长度最大的路径吗? 输入格式 第一行包含整数n, ...

  2. python数据可视化示例柱状图

    from matplotlib import pyplot as plt import platform import pandas from pathlib import Path # 根据不同的平 ...

  3. 全链路跟踪skywalking简介

    该文章主要包括以下内容: skywalking的简介 skywalking的使用,支持多种调用中间件(httpclent,springmvc,dubbo,mysql等等) skywalking的tra ...

  4. HttpClient : java.net.SocketException: Connection reset

    1. 问题排查 httpclient : 4.5.5 排查过程 : 一次SocketException:Connection reset 异常排查 主要原因 : 调用 http 请求时发生了 Sock ...

  5. IDEA找回Run Dashboard

    特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过.如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/ ...

  6. 【java测试】Junit、Mock+代码覆盖率

    原文见此处 单元测试是编写测试代码,用来检测特定的.明确的.细颗粒的功能.单元测试并不一定保证程序功能是正确的,更不保证整体业务是准备的. 单元测试不仅仅用来保证当前代码的正确性,更重要的是用来保证代 ...

  7. 如何查看 SELinux状态及关闭SELinux

    查看SELinux状态: 1./usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态 SELinux status:         ...

  8. zabbix客户端监控

    1.安装zabbix客户端软件: yum install -y zabbix20-agent2.修改配置文件vim /etc/zabbix_agentd.conf修改如下: (1)更改Server,S ...

  9. java+实现文件的上传和下载

    项目截图 路径配置 将localhost:8080/up6全部替换为实际项目路径 使用mysql文件夹下的脚本创建数据表. 创建后可以在数据库中看到创建好的数据表 2.修改数据库连接 3.修改上传地址 ...

  10. frei0r-1.7.0 20191207-0d4b342 DLLs

    https://files.cnblogs.com/files/nlsoft/frei0r-20191207-0d4b342-bin.7z