无标题文档
wdCP系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用教程) wdCDN系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用手册)
wdOS系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用教程) wdDNS系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用手册)
注册 发贴 提问 回复-必看必看 wddns免费智能 DNS 开通 本地或虚拟机使 用wdcp 一键包在mysql编 译时"卡住"
AI导航网AI应用网站大全 wdcp官方技术支持/服务 阿里云8折优惠券 无敌云 腾讯云优惠中,现注册更有260代金额券赠送
返回列表 发帖
提问三步曲: 提问先看教程/FAQ索引(wdcp,wdcp_v3,一键包)及搜索,会让你更快解决问题
1 提供详细,如系统版本,wdcp版本,软件版本等及错误的详细信息,贴上论坛或截图发论坛
2 做过哪些操作或改动设置等

温馨提示:信息不详,很可能会没人理你!论坛有教程说明的,也可能没人理!因为,你懂的

[教程] WDCP升级mysql 8.0脚本,亲测可用 2021.01.26

  1. #!/bin/bash
  2. # mysql 8.0 update scripts
  3. # Author: wdlinux
  4. # Url: http://www.wdlinux.cn
  5. # Modify: windsage

  6. IN_DIR="/www/wdlinux"

  7. if [ ! $1 ];then
  8.     MYS_VER="8.0.11"
  9. else
  10.     MYS_VER=$1
  11. fi

  12. echo "升级有风险 操作需谨慎"
  13. echo "欢迎学习交流互助提高"
  14. echo "qq:242013800"
  15. echo
  16. read -p "DO YOU REALLY WANT TO UPDATE? (Y/N): " yn
  17. if [ "$yn" == "Y" ] || [ "$yn" == "y" ]; then
  18.     echo "MYSQL IS NOW UPDATING!"
  19. else
  20.     exit
  21. fi
  22. echo
  23. echo "-------------------------------------------------------------"
  24. echo


  25. if [ ! -f mysql-boost-${MYS_VER}.tar.gz ];then
  26. # 因mysql5.7需要boost,所以这个直接是包含boost的源码包
  27.     wget -c https://downloads.mysql.com/archives/get/p/23/file/mysql-boost-${MYS_VER}.tar.gz
  28. fi
  29. yum install -y cmake bison libmcrypt-devel libjpeg-devel libpng-devel freetype-devel curl-devel openssl-devel libxml2-devel zip unzip
  30. if [ ! -d $IN_DIR/mysql-${MYS_VER} ];then
  31. mkdir -p $IN_DIR/mysql-${MYS_VER}
  32. # 数据库文件夹默认要求是data
  33. mkdir -p $IN_DIR/mysql-${MYS_VER}/data
  34. fi

  35. if [ ! -d mysql-${MYS_VER} ];then
  36. tar zxvf mysql-boost-${MYS_VER}.tar.gz
  37. fi

  38. cd mysql-${MYS_VER}

  39. echo "START CONFIGURING MYSQL"
  40. sleep 3
  41. #mkdir -p build
  42. #cd  build/
  43. make clean
  44. cmake \
  45. -DFORCE_INSOURCE_BUILD=1 \
  46. -DCMAKE_INSTALL_PREFIX=$IN_DIR/mysql-$MYS_VER \
  47. -DSYSCONFDIR=$IN_DIR/etc \
  48. -DDEFAULT_CHARSET=utf8 \
  49. -DDEFAULT_COLLATION=utf8_general_ci \
  50. -DWITH_SSL=bundled \
  51. -DWITH_DEBUG=OFF \
  52. -DWITH_EXTRA_CHARSETS=complex \
  53. -DENABLED_PROFILING=ON \
  54. -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  55. -DWITH_MYISAM_STORAGE_ENGINE=1 \
  56. -DWITH_MEMORY_STORAGE_ENGINE=1 \
  57. -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
  58. -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
  59. -DENABLE_DOWNLOADS=1 \
  60. -DWITH_BOOST=./boost/boost_1_66_0/
  61. [ $? != 0 ] && echo "NO! CONFIGURE ERROR!  :(" && exit

  62. echo "START MAKE"
  63. sleep 3
  64. make
  65. [ $? != 0 ] && echo "NO! MAKE ERROR!  :(" && exit
  66. echo "START MAKE INSTALL"
  67. sleep 3
  68. make install
  69. [ $? != 0 ] && echo "NO! MAKE INSTALL ERROR!  :(" && exit

  70. service mysqld stop
  71. #cd ..
  72. # 建立备份文件夹,这个可以自定义设置,建议一开始就先备份,不要问我为什么,这样可视化安全更放心
  73. if [ ! -d /www/wdlinux/mysql_bk ];then
  74. mkdir -p /www/wdlinux/mysql_bk
  75. cp -pR /www/wdlinux/mysql/data/* /www/wdlinux/mysql_bk
  76. fi
  77. rm -f /www/wdlinux/mysql
  78. ln -sf $IN_DIR/mysql-$MYS_VER /www/wdlinux/mysql
  79. sh scripts/mysql_install_db.sh --user=mysql --basedir=/www/wdlinux/mysql --datadir=/www/wdlinux/mysql/data
  80. chown -R mysql.mysql /www/wdlinux/mysql
  81. chown -R mysql.mysql /www/wdlinux/mysql/data
  82. mv /www/wdlinux/mysql/data/mysql /www/wdlinux/mysql/data/mysqlo
  83. cp support-files/mysql.server /www/wdlinux/init.d/mysqld
  84. chmod 755 /www/wdlinux/init.d/mysqld
  85. service mysqld restart
  86. ln -sf $IN_DIR/mysql/lib/libmysqlclient.so.20. /usr/lib/libmysqlclient.so.20
  87. cd ..
  88. rm -rf mysql-${Ver}/
  89. # rm -rf mysql-${Ver}.tar.gz
  90. sleep 2
  91. service mysqld restart
  92. sleep 2
  93. mysqld --initialize --user=mysql --console
  94. # 或者把备份的数据库复制回来,注意不要覆盖performance_schema
  95. # cp -pR /mnt/mysql_bk/* /www/wdlinux/mysql/data/  
  96. echo
  97. echo "-------------------------------------------------------------"
  98. echo "数据库需要初始化,自动生成的密码会存入mysql的日志,默认在/var/log/mysql/error.log"
  99. echo
  100. echo "此时查看mysql日志,应该一切正常了,但新手朋友注意了,此时你的httpd无法启动了,需要编译安装php。"
  101. echo
复制代码




  • 注意,安装的事8.0.11, 如果是其他的,需要修改boost的文件夹名字,boost_1_66_0 这个地方,可以解压mysql后看看,可能是其他名字
好人

遇到的问题

1. 内存不够容易卡死,增加swap文件
2. my.cnf有写参数错误,导致初始化错误,根据提示,删掉一些没用参数,把/www/wdlinux/mysql/data重新命名,然后重新初始化
mysqld --initialize --user=mysql --console --basedir=/www/wdlinux/mysql --datadir=/www/wdlinux/mysql/data
好人

TOP

升级完mysql, 重新编译php

下面是php 7.3.26
  1. #!/bin/bash
  2. # PHP 7.1 update scripts
  3. # Author: wdlinux
  4. # Url: http://www.wdlinux.cn
  5. # Modify: slrainy

  6. if [ ! $1 ];then
  7.         Ver=7.3.26
  8. else
  9.         Ver=$1
  10. fi
  11. echo "升级有风险 操作需谨慎"
  12. echo "欢迎学习交流互助提高"
  13. echo "qq:6824498"
  14. echo "点击链接加入群(207118653)【lanmp php thinkphp5 交流】:https://jq.qq.com/?_wv=1027&k=45CsOTO"
  15. echo
  16. #read -p "PRESS ENTER IF YOU REALLY WANT TO UPDATE"
  17. read -p "DO YOU REALLY WANT TO UPDATE? (Y/N): " yn
  18. if [ "$yn" == "Y" ] || [ "$yn" == "y" ]; then
  19.         echo "PHP IS NOW UPDATING!"
  20. else
  21.         exit
  22. fi
  23. echo
  24. echo "-------------------------------------------------------------"
  25. echo

  26. ###yum
  27. yum clean all
  28. yum install -y gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel curl-devel patch libmcrypt-devel libmhash-devel ncurses-devel bzip2-devel libcap-devel gmp-devel t1lib-devel libc-client-devel sqlite-devel aspell-devel readline-devel recode-devel libtidy-devel libxslt-devel openldap-devel
  29. ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
  30. ###
  31. if [ ! -f php-${Ver}.tar.gz ];then
  32.         wget -c http://cn2.php.net/distributions/php-${Ver}.tar.gz
  33. fi
  34. if [ ! -f iconv_ins.sh ];then
  35.         wget -c http://down.wdlinux.cn/in/iconv_ins.sh
  36. fi
  37.         sh iconv_ins.sh

  38. ###
  39. if [ -f /www/wdlinux/mysql/lib/libmysqlclient.so.20 ];then
  40.         if [ -d /usr/lib64 ];then
  41.                 LIBNCU="/usr/lib64"
  42.         else
  43.                 LIBNCU="/usr/lib"
  44.         fi
  45.         ln -sf /www/wdlinux/mysql/lib/libmysqlclient.so.20 $LIBNCU
  46. fi
  47. if [ ! -f php-${Ver} ];then
  48. tar zxvf php-${Ver}.tar.gz
  49. fi
  50. cd php-${Ver}
  51. if [ -d /www/wdlinux/apache_php ];then
  52. make clean
  53. ./configure \
  54. --prefix=/www/wdlinux/apache_php-${Ver} \
  55. --exec-prefix=/www/wdlinux/apache_php-${Ver} \
  56. --bindir=/www/wdlinux/apache_php-${Ver}/bin \
  57. --sbindir=/www/wdlinux/apache_php-${Ver}/sbin \
  58. --libdir=/www/wdlinux/apache_php-${Ver}/lib/php \
  59. --mandir=/www/wdlinux/apache_php-${Ver}/php/man \
  60. --with-config-file-path=/www/wdlinux/apache_php-${Ver}/etc \
  61. --with-apxs2=/www/wdlinux/apache/bin/apxs \
  62. --with-mhash \
  63. --with-openssl \
  64. --with-mysqli=/www/wdlinux/mysql/bin/mysql_config \
  65. --with-pdo-mysql=/www/wdlinux/mysql \
  66. --with-gd \
  67. --with-iconv \
  68. --with-zlib \
  69. --enable-zip \
  70. --with-kerberos \
  71. --with-pcre-regex \
  72. --with-libxml-dir=/usr \
  73. --enable-inline-optimization \
  74. --disable-debug \
  75. --disable-rpath \
  76. --enable-shared \
  77. --enable-xml \
  78. --enable-bcmath \
  79. --enable-shmop \
  80. --enable-sysvsem \
  81. --enable-mbregex \
  82. --enable-mbstring \
  83. --enable-ftp \
  84. --enable-pcntl \
  85. --enable-sockets \
  86. --with-xmlrpc \
  87. --enable-soap \
  88. --without-pear \
  89. --with-gettext \
  90. --enable-session \
  91. --with-curl \
  92. --with-jpeg-dir \
  93. --with-png-dir \
  94. --with-freetype-dir \
  95. --enable-opcache \
  96. --enable-fpm \
  97. --without-gdbm \
  98. --disable-fileinfo
  99. [ $? != 0 ] && echo "configure err" && exit
  100. make ZEND_EXTRA_LIBS='-liconv'
  101. [ $? != 0 ] && echo "make err" && exit
  102. make install
  103. [ $? != 0 ] && echo "make install err" && exit
  104. cp php.ini-production /www/wdlinux/apache_php-${Ver}/etc/php.ini
  105. sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/apache_php-${Ver}/etc/php.ini
  106. rm -f /www/wdlinux/apache_php
  107. ln -sf /www/wdlinux/apache_php-${Ver} /www/wdlinux/apache_php
  108. if [ ! -d /www/wdlinux/apache_php-${Ver}/lib/php/extensions ];then
  109.         mkdir -p /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-zts-20131226
  110.         ln -sf /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-zts-20131226 /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-non-zts-20131226
  111. fi
  112. service httpd restart
  113. echo
  114. echo "如果升级后httpd无法启动,打开httpd.conf,注释 #LoadModule php5_module        modules/libphp5.so"
  115. echo "php update compelete"
  116. fi

  117. if [ -d /www/wdlinux/nginx_php ];then
  118. make clean
  119. ./configure --prefix=/www/wdlinux/nginx_php-${Ver} --with-config-file-path=/www/wdlinux/nginx_php-${Ver}/etc --with-mysql=/www/wdlinux/mysql --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-soap --with-imap --with-kerberos --with-imap-ssl  --enable-ftp --enable-sockets --enable-zip --enable-fpm --with-mysqli=/www/wdlinux/mysql/bin/mysql_config --with-pdo-mysql=/www/wdlinux/mysql
  120. [ $? != 0 ] && echo "configure err" && exit
  121. make
  122. [ $? != 0 ] && echo "make err" && exit
  123. make install
  124. [ $? != 0 ] && echo "make install err" && exit
  125. cp php.ini-production /www/wdlinux/nginx_php-${Ver}/etc/php.ini
  126. sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/nginx_php-${Ver}/etc/php.ini
  127. service php-fpm stop
  128. rm -f /www/wdlinux/nginx_php
  129. ln -sf /www/wdlinux/nginx_php-${Ver} /www/wdlinux/nginx_php
  130. cp /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf.default /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf
  131. sed -i 's/user = nobody/user = www/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
  132. sed -i 's/group = nobody/group = www/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
  133. sed -i 's/;pid =/pid =/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
  134. cp -f sapi/fpm/init.d.php-fpm /www/wdlinux/init.d/php-fpm
  135. chmod 755 /www/wdlinux/init.d/php-fpm
  136. if [ ! -d /www/wdlinux/nginx_php-${Ver}/lib/php/extensions ];then
  137.         mkdir -p /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-20131226
  138.         ln -sf /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-20131226 /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-non-zts-20131226
  139. fi
  140. service php-fpm start
  141. echo
  142. echo "php update is OK"
  143. fi
  144. echo
复制代码
好人

TOP

php安装过程中, Lib可能出错,参考https://blog.csdn.net/zsl10/article/details/52143713
好人

TOP

可能还是每个服务器有其独特的情况吧,在wdcp下升级mysql,极少有顺利的。
mysql升级后,pid有问题,不想折腾,好在云服务器快照下,回滚了。
yunhai.cc

TOP

我也是昨天折腾了一天,全报错,我是想升级到5.7.3.4,可能就如上面说的我没有设置boost_1_66_0
晓瞧流水

TOP

返回列表