设为首页 收藏本站
查看: 429|回复: 0

[经验分享] MySQL 5.7.17源码编译安装说明

[复制链接]

尚未签到

发表于 2018-9-30 06:45:13 | 显示全部楼层 |阅读模式
  一、系统环境

  CentOS>  Linux 2.6.32-431.el6.x86_64
  最小化安装
  关闭selinux, iptables,ip6tables
  # yum install -y gcc-c++ readline-devel zlib-devel bison
  二、安装准备
  1.cmake
  https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz
  2.boost
  https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
  3.mysql
  https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.17.tar.gz
  三、preinstall
  1.cmake
  # cd cmake-3.7.2
  # ./bootstrap
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/soft/cmake-3.7.2
  ---------------------------------------------
  CMake has bootstrapped.  Now run gmake.
  #
  # make && make install
  # cmake --version
  cmake version 3.7.2
  CMake suite maintained and supported by Kitware (kitware.com/cmake).
  #
  2.boost
  # cd /home/soft/
  # tar -zxvf boost_1_59_0.tar.gz -C /usr/local
  # mv boost_1_59_0 boost
  # cd boost/
  # ./bootstrap.sh
  # ./b2 install
  四、安装mysql
  user and group
  # groupadd mysql
  # useradd -r -g mysql -s /bin/false mysql
  install,data,log,temp dir
  # mkdir -p /opt/mysql/data  /opt/mysql/logs /opt/mysql/temp
  # vi /etc/profile
  # use for mysql
  export PATH=/opt/mysql/bin:/opt/mysql/lib:$PATH
  # tar zxvf mysql-5.7.17.tar.gz
  # cd mysql-5.7.17
  # cmake \
  -DCMAKE_INSTALL_PREFIX=/opt/mysql
  -DMYSQL_UNIX_ADDR=/opt/mysql/data/mysql.sock
  -DDEFAULT_CHARSET=utf8
  -DDEFAULT_COLLATION=utf8_general_ci
  -DWITH_MYISAM_STORAGE_ENGINE=1 \
  -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
  -DWITH_MEMORY_STORAGE_ENGINE=1 \
  -DWITH_READLINE=1 \
  -DENABLED_LOCAL_INFILE=1 \
  -DMYSQL_DATADIR=/opt/mysql/data \
  -DMYSQL_USER=mysql \
  -DMYSQL_TCP_PORT=3306 \
  -DENABLE_DOWNLOADS=1 \
  -DDOWNLOAD_BOOST=1 \
  -DWITH_BOOST=/usr/local/boost
  # make && make install
  # chown -R mysql:mysql /opt/mysql
  编辑配置文件my.cnf
  # vi /etc/my.cnf
  # For advice on how to change settings please see
  # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
  # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
  # *** default location during install, and will be replaced if you
  # *** upgrade to a newer version of MySQL.
  [mysqld]
  # new add:explicit_defaults_for_timestamp
  explicit_defaults_for_timestamp=true
  # Remove leading # and set to the amount of RAM for the most important data
  # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
  # innodb_buffer_pool_size = 128M
  # Remove leading # to turn on a very important data integrity option: logging
  # changes to the binary log between backups.
  # log_bin
  # These are commonly set, remove the # and set as required.
  # basedir = .....
  # datadir = .....
  # port = .....
  # server_id = .....
  # socket = .....
  # Remove leading # to set options mainly useful for reporting servers.
  # The server defaults are faster for transactions and fast SELECTs.

  # Adjust>  # join_buffer_size = 128M
  # sort_buffer_size = 2M
  # read_rnd_buffer_size = 2M
  # new add: NO_AUTO_CREATE_USER,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO
  sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO
  # bin/mysqld --initialize --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql
  2017-02-27T11:54:01.604788Z 0 [Warning] InnoDB: New log files created, LSN=45790
  2017-02-27T11:54:01.930913Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
  2017-02-27T11:54:01.962973Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6e4c012a-fce3-11e6-aa31-000c29e3a907.
  2017-02-27T11:54:01.967537Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
  2017-02-27T11:54:01.970198Z 1 [Note] A temporary password is generated for root@localhost: Q!0+tqhgQ(iI
  #
  ADD boot item
  # cp support-files/mysql.server /etc/init.d/mysqld
  # chmod +x mysqld
  # chmod +x /etc/init.d/mysqld
  # chkconfig --add mysqld
  启动数据库
  # /etc/init.d/mysqld start
  Starting MySQL.Logging to '/opt/mysql/data/localhost.localdomain.err'.
  .. SUCCESS!
  #
  五、使用临时密码登录,重置root密码
  # mysql -uroot -p
  Enter password: (临时生成的root密码)
  Welcome to the MySQL monitor.  Commands end with ; or \g.

  Your MySQL connection>  Server version: 5.7.17
  Copyright (c) 2000, 2016, 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>  ALTER USER 'root'@'localhost'>  mysql> flush privileges;
  Query OK, 0 rows affected (0.01 sec)
  mysql> \q


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-606034-1-1.html 上篇帖子: rsync+inotify同步备份MYSQL数据 下篇帖子: MySQL/MariaDB的索引使用
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表