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

[经验分享] Fpm 之 Mysql-5.7.21 rpm 包制作

[复制链接]

尚未签到

发表于 2018-10-5 11:39:18 | 显示全部楼层 |阅读模式
1. 下载安装包  wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
  wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21.tar.gz
  2.安装依赖包
  yum -y install gcc gcc-c++ ncurses ncurses-devel cmake
  3.添加mysql 用户与组
  groupadd mysql
  useradd -r -g mysql mysql
  4.新建MYSQL的安装目录,与数据存放目录
  mkdir -p /app/mysql
  mkdir -p /app/data
  5.解压安装
  tar -zxvf boost_1_59_0.tar.gz
  tar -zxvf mysql-5.7.21.tar.gz
  cd mysql-5.7.21      #进入mysql的解压目录
  6.使用cmake 编译mysql
  cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql -DMYSQL_DATADIR=/app/data -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/root/boost_1_59_0 -DSYSCONFDIR=/etc \-DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DWITH_EMBEDDED_SERVER=1
  7.编译安装mysql
  make && make install
  8.设置开机自动启动脚本
  cp /app/mysql/support-files/mysql.server /etc/init.d/mysqld
  chmod +x /etc/init.d/mysqld
  chkconfig --add mysqld
  chkconfig mysqld on
  9.修改MYSQL的环境变量
  vi /etc/profile
  export PATH=$PATH:/app/mysql/bin
  source /etc/profile
  10.修改MYSQL所在目录权限
  chown -R mysql:mysql /app/mysql
  11.初始化MYSQL数据库
  [root@localhost ~]# /app/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/app/mysql --datadir=/app/mysql/data
  2018-03-26T07:31:17.298033Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  2018-03-26T07:31:18.332278Z 0 [Warning] InnoDB: New log files created, LSN=45790
  2018-03-26T07:31:18.436844Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
  2018-03-26T07:31:18.453099Z 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: ac7149bc-30c7-11e8-999a-005056804f18.
  2018-03-26T07:31:18.458082Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
  2018-03-26T07:31:18.458468Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
  [root@localhost ~]# ll /app/data/
  total 110620
  -rw-r-----. 1 mysql mysql       56 Mar 26 15:31 auto.cnf
  -rw-r-----. 1 mysql mysql      420 Mar 26 15:31 ib_buffer_pool
  -rw-r-----. 1 mysql mysql 12582912 Mar 26 15:31 ibdata1
  -rw-r-----. 1 mysql mysql 50331648 Mar 26 15:31 ib_logfile0
  -rw-r-----. 1 mysql mysql 50331648 Mar 26 15:31 ib_logfile1
  drwxr-x---. 2 mysql mysql     4096 Mar 26 15:31 mysql
  drwxr-x---. 2 mysql mysql     4096 Mar 26 15:31 performance_schema
  drwxr-x---. 2 mysql mysql    12288 Mar 26 15:31 sys
  12.修改配置文件,如下:
  vi /etc/my.cnf
  [client]
  port=3306
  socket=/tmp/mysql.sock
  [mysqld]
  # 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.
  user = mysql
  basedir = /app/mysql
  datadir = /app/mysql/data
  port=3306
  server-id = 1
  socket=/tmp/mysql.sock
  character-set-server = utf8
  #log-error = /var/log/mysql/error.log
  #pid-file = /var/log/mysql/mysql.pid
  general_log = 1
  skip-name-resolve
  #skip-networking
  back_log = 300
  max_connections = 1000
  max_connect_errors = 6000
  open_files_limit = 65535
  table_open_cache = 128
  max_allowed_packet = 4M
  binlog_cache_size = 1M
  max_heap_table_size = 8M
  tmp_table_size = 16M
  read_buffer_size = 2M
  read_rnd_buffer_size = 8M
  sort_buffer_size = 8M
  join_buffer_size = 28M
  key_buffer_size = 4M
  thread_cache_size = 8
  query_cache_type = 1
  query_cache_size = 8M
  query_cache_limit = 2M
  ft_min_word_len = 4
  log_bin = mysql-bin
  binlog_format = mixed
  expire_logs_days = 30
  performance_schema = 0
  explicit_defaults_for_timestamp
  #lower_case_table_names = 1
  myisam_sort_buffer_size = 8M
  myisam_repair_threads = 1
  interactive_timeout = 28800
  wait_timeout = 28800
  # 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
  # Disabling symbolic-links is recommended to prevent assorted security risks
  symbolic-links=0
  # Recommended in standard MySQL setup
  sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER,STRICT_TRANS_TABLES
  [mysqldump]
  quick
  max_allowed_packet = 16M
  13.创建错误日志与PID存放位置
  mkdir -p /var/log/mysql/
  chown -R mysql:mysql /var/log/mysql/
  14.启动mysql
  [root@localhost mysql]# service mysqld start
  Starting MySQL.[  OK  ]
  [root@localhost mysql]# netstat -tlnp | grep 3306
  tcp        0      0 :::3306                     :::*                        LISTEN      27565/mysqld


运维网声明 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-612621-1-1.html 上篇帖子: 数据库mysql linux-wb 下篇帖子: 使用VS Code调试MySQL
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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