{"id":751,"date":"2017-12-05T18:50:40","date_gmt":"2017-12-05T10:50:40","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=751"},"modified":"2017-12-05T18:50:40","modified_gmt":"2017-12-05T10:50:40","slug":"mysql-5-7-19-%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/751","title":{"rendered":"MySQL 5.7.19 \u7f16\u8bd1\u5b89\u88c5\u4e0e\u914d\u7f6e"},"content":{"rendered":"<div class=\"author\">\n<div class=\"info\"><span class=\"name\"><a href=\"http:\/\/www.jianshu.com\/u\/6196900dec0f\">pijh<\/a><\/span>\u00a0<a class=\"btn btn-success follow\"><i class=\"iconfont ic-follow\"><\/i>\u5173\u6ce8<\/a><\/p>\n<div class=\"meta\"><span class=\"publish-time\" title=\"\" data-toggle=\"tooltip\" data-placement=\"bottom\" data-original-title=\"\u6700\u540e\u7f16\u8f91\u4e8e 2017.09.25 09:17\">2017.09.24 11:53*<\/span>\u00a0<span class=\"wordage\">\u5b57\u6570 1994<\/span>\u00a0<span class=\"views-count\">\u9605\u8bfb 492<\/span><span class=\"comments-count\">\u8bc4\u8bba 0<\/span><span class=\"likes-count\">\u559c\u6b22 3<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"show-content\" data-note-content=\"\">\n<blockquote><p>\u80cc\u666f\uff1a<a href=\"http:\/\/pijunhui.com\/\" target=\"_blank\" rel=\"noopener\">\u672c\u4eba\u535a\u5ba2<\/a>\u81ea2014\u5e74\u4e0a\u7ebf\u4ee5\u6765\uff0c\u4e00\u76f4\u4f7f\u7528\u963f\u91cc\u4e91<code>ECS<\/code>\u6700\u4f4e\u914d\u7684\u5b9e\u4f8b\uff0c\u7531\u4e8e\u6700\u8fd1\u963f\u91cc\u4e91<code>ECS<\/code>\u8fdb\u884c\u4e86\u5347\u7ea7\u8fc1\u79fb\uff0c\u539f\u6765\u7684\u4f4e\u914d\u5b9e\u4f8b\u5df2\u7ecf\u4e0d\u5b58\u5728\u4e86\uff0c\u5347\u7ea7\u540e\u5b9e\u4f8b\u7684\u914d\u7f6e\u6709\u6240\u63d0\u5347\uff0c\u5f53\u7136\u4ef7\u683c\u66f4\u9ad8\u4e86\uff0c\u4e3a\u4e86\u66f4\u597d\u7684\u53d1\u6325\u670d\u52a1\u5668\u6027\u80fd\uff0c\u6240\u4ee5\u5c31\u60f3\u5229\u7528\u7a7a\u95f2\u65f6\u95f4\u5bf9\u6574\u7ad9\u8fdb\u884c\u5347\u7ea7\uff0c\u5305\u542b<code>\u963f\u91cc\u4e91ecs\u66f4\u6362\u7cfb\u7edf\u76d8<\/code>\uff0c<code>MySQL 5.7.19 \u7f16\u8bd1\u5b89\u88c5\u4e0e\u914d\u7f6e<\/code>,\u00a0<code>Nginx 1.12.1 \u7f16\u8bd1\u5b89\u88c5\u4e0e\u914d\u7f6e<\/code>,\u00a0<code>PHP 7.1.9 \u7f16\u8bd1\u5b89\u88c5\u4e0e\u914d\u7f6e<\/code>\u7b49\u3002<\/p><\/blockquote>\n<blockquote><p>\u670d\u52a1\u5668\u73af\u5883<br \/>\n<code>CentOS 6.3 64\u4f4d \u5168\u65b0\u7eaf\u51c0\u7684\u7cfb\u7edf<\/code>\u00a0\/\u00a0<code>1\u68381GB<\/code>\u00a0\/\u00a0<code>\u7ecf\u5178\u7f51\u7edc 1MB<\/code><\/p><\/blockquote>\n<h5>\u8fdb\u5165MySQL\u5b98\u7f51\u4e0b\u8f7d\u9875\u9762\uff0c\u5730\u5740<a href=\"https:\/\/www.mysql.com\/downloads\/\" target=\"_blank\" rel=\"noopener\"><code>https:\/\/www.mysql.com\/downloads\/<\/code><\/a>\uff0c\u5982\u679c\u4f60\u60f3\u4f7f\u7528MySQL 5.7.19\u7684\u6e90\u7801\u7248\u672c\uff0c<a href=\"https:\/\/dev.mysql.com\/get\/Downloads\/MySQL-5.7\/mysql-boost-5.7.19.tar.gz\" target=\"_blank\" rel=\"noopener\">\u70b9\u6b64\u5904<\/a>\u76f4\u63a5\u4e0b\u8f7d!<\/h5>\n<h5>\u8fdb\u5165MySQL Community Edition\u4e0b\u8f7d\u9875\u9762<\/h5>\n<div class=\"image-package\"><img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-c16babd56ba68463.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/620\" alt=\"\u70b9\u51fb\u8fdb\u5165MySQL Community Edition\u4e0b\u8f7d\u9875\u9762\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-c16babd56ba68463.png?imageMogr2\/auto-orient\/strip\" \/><\/p>\n<div class=\"image-caption\">\u70b9\u51fb\u8fdb\u5165MySQL Community Edition\u4e0b\u8f7d\u9875\u9762<\/div>\n<\/div>\n<div class=\"image-package\"><img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-1fb71fb926ff6bf6.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/620\" alt=\"\u70b9\u51fbDOWNLOAD\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-1fb71fb926ff6bf6.png?imageMogr2\/auto-orient\/strip\" \/><\/p>\n<div class=\"image-caption\">\u70b9\u51fbDOWNLOAD<\/div>\n<\/div>\n<h5>\u9009\u62e9\u64cd\u4f5c\u7cfb\u7edf\u4e3a<code>Source Code<\/code>\uff0c\u9009\u62e9\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u4e3a<code>Generic Linux<\/code>\uff0c\u9009\u62e9<code>Compressed TAR Archive, Includes Boost Headers<\/code>\u7248\u672c\u6216<code>Compressed TAR Archive<\/code>\u7248\u672c\uff0c\u6682\u672a\u7814\u7a76\u4e24\u4e2a\u7248\u672c\u7684\u533a\u522b\uff0c\u5f00\u59cb\u4ee5\u4e3aIncludes Boost Headers\u4e0d\u7528\u518d\u53bb\u4e0b\u8f7dBoost\u5e93\uff0c\u7136\u800c\u5b89\u88c5\u65f6\u53d1\u73b0\u8fd8\u662f\u9700\u8981\uff0c\u6240\u4ee5\u6b64\u5904\u5148\u4efb\u610f\u9009\u62e9\u4e00\u4e2a\u7248\u672c\uff0c\u9009\u62e9\u70b9\u51fb\u00a0<strong>Download<\/strong>\u00a0\u8fdb\u884c\u4e0b\u8f7d<\/h5>\n<div class=\"image-package\"><img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-a790f533ae3325dd.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/620\" alt=\"\u9009\u62e9\u6e90\u7801\u4e0b\u8f7d\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-a790f533ae3325dd.png?imageMogr2\/auto-orient\/strip\" \/><\/p>\n<div class=\"image-caption\">\u9009\u62e9\u6e90\u7801\u4e0b\u8f7d<\/div>\n<\/div>\n<div class=\"image-package\"><img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-7fecace328fe186c.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/620\" alt=\"\u70b9\u51fb\u4e0b\u8f7d\uff0c\u6b64\u5904\u5e76\u4e0d\u9700\u8981\u6ce8\u518c\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-7fecace328fe186c.png?imageMogr2\/auto-orient\/strip\" \/><\/p>\n<div class=\"image-caption\">\u70b9\u51fb\u4e0b\u8f7d\uff0c\u6b64\u5904\u5e76\u4e0d\u9700\u8981\u6ce8\u518c<\/div>\n<\/div>\n<h5>\u8fdb\u5165<code>\/usr\/local\/src<\/code>\u76ee\u5f55\uff0c\u4e00\u822c\u6211\u559c\u6b22\u628a\u4e0b\u8f7d\u7684\u6587\u4ef6\u653e\u5728\u6b64\u76ee\u5f55\uff0c\u6839\u636e\u81ea\u5df1\u7684\u559c\u597d\u8bbe\u5b9a<\/h5>\n<p><code>[root@iZ2864f6btwZ src]# cd \/usr\/local\/src<\/code><\/p>\n<h5>\u4e0b\u8f7dMySQL\u6587\u4ef6\uff0c\u5982\u679cwget\u6ca1\u6709\u5b89\u88c5\uff0c<code>yum -y install wget<\/code>\u5373\u53ef\u5b89\u88c5<\/h5>\n<p><code>[root@iZ2864f6btwZ src]# wget https:\/\/dev.mysql.com\/get\/Downloads\/MySQL-5.7\/mysql-boost-5.7.19.tar.gz<\/code><\/p>\n<blockquote><p><strong>\u95ee\u9898\u9519\u8bef\uff1a<\/strong><br \/>\n\u5982\u679c\u6b64\u5904\u4e0b\u8f7d\u9047\u5230\u5982\u4e0b\u95ee\u9898\uff0c\u8bf4\u660e\u4f60\u6ca1\u6709\u5b89\u88c5openssl\uff0c\u6b64\u95ee\u9898\u4e00\u822c\u53ea\u4f1a\u51fa\u73b0\u5728\u5168\u65b0\u7684\u673a\u5668\u4e0a<br \/>\n<code>[root@iZ2864f6btwZ src]# wget https:\/\/dev.mysql.com\/get\/Downloads\/MySQL-5.7\/mysql-boost-5.7.19.tar.gz--2017-09-22 16:20:26-- https:\/\/dev.mysql.com\/get\/Downloads\/MySQL-5.7\/mysql-boost-5.7.19.tar.gz Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11 Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected. Unable to establish SSL connection.<\/code><\/p><\/blockquote>\n<blockquote><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><br \/>\n\u5b89\u88c5opensll\uff0c<code>yum -y install openssl<\/code>\u00a0\u518d\u6b21\u6267\u884c\u4e0b\u8f7d\u547d\u4ee4\u5373\u53ef<\/p><\/blockquote>\n<h5>\u7531\u4e8eMySQL 5.7\u9700\u8981boost 1.59\u4ee5\u53ca\u4ee5\u4e0a\u7248\u672c\uff0c\u6240\u4ee5\u8fd8\u9700\u8981\u4e0b\u8f7dboost\u5e93\uff0c\u6839\u636e\u672c\u4eba\u6d4b\u8bd51.59\u7248\u672c\u7684\u6700\u4e3a\u9002\u5408\uff0c\u5176\u5b83\u9ad8\u7248\u672c\u5728\u5b89\u88c5\u7684\u65f6\u5019\u9047\u5230\u4e86\u4e00\u4e9b\u95ee\u9898\uff0c\u76ee\u524d\u672a\u89e3\u51b3\uff1b<a href=\"http:\/\/www.boost.org\/users\/history\/version_1_59_0.html\" target=\"_blank\" rel=\"noopener\">\u4e0b\u8f7d\u5730\u5740<\/a>\uff0c\u4f60\u4e5f\u53ef\u4ee5\u70b9\u51fb<a href=\"http:\/\/sourceforge.net\/projects\/boost\/files\/boost\/1.59.0\/boost_1_59_0.tar.gz\" target=\"_blank\" rel=\"noopener\">\u6b64\u5904<\/a>\u76f4\u63a5\u4e0b\u8f7d<code>boost_1_59_0.tar.gz<\/code>\uff0c\u5982\u679cwget\u65e0\u6cd5\u4e0b\u8f7d\uff0c\u5efa\u8bae\u4f7f\u7528\u8fc5\u96f7\u4e0b\u8f7d\u540e\u518d\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u76ee\u5f55<\/h5>\n<p><code>[root@iZ2864f6btwZ src]# wget http:\/\/sourceforge.net\/projects\/boost\/files\/boost\/1.59.0\/boost_1_59_0.tar.gz<\/code><\/p>\n<h5>\u89e3\u538b boost\u5e76\u62f7\u8d1d boost \u5230 \/usr\/local\/boost \u76ee\u5f55<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ src]# tar zxvf boost_1_59_0.tar.gz\r\n[root@iZ2864f6btwZ src]# cp -r boost_1_59_0 \/usr\/local\/boost\r\n<\/code><\/pre>\n<h5>\u5b89\u88c5\u7f16\u8bd1\u6240\u9700\u7684\u5e38\u7528\u7ec4\u4ef6\u548c\u4f9d\u8d56\u5305\u00a0<strong>[ \u53c2\u8003\u4e8e\u7f51\u7edc\u535a\u5ba2 ]<\/strong><\/h5>\n<p><code>[root@iZ2864f6btwZ src]# yum -y install gcc gcc-c++ ncurses ncurses-devel bison libgcrypt perl make cmake<\/code><\/p>\n<h5>\u521b\u5efamysql\u7528\u6237\u7ec4\u548c\u7528\u6237\uff0c\u7528\u6765\u8fd0\u884cmysql\u670d\u52a1\u5668\uff0c\u00a0<code>-g<\/code>\u6307\u5b9a\u7528\u6237\u7ec4,\u00a0<code>-r<\/code>\u521b\u5efa\u7cfb\u7edf\u7528\u6237<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ src]# groupadd mysql\r\n[root@iZ2864f6btwZ src]# useradd -r -g mysql -s \/bin\/false -M mysql\r\n<\/code><\/pre>\n<h5>\u89e3\u538bMySQL\uff0c\u8fdb\u5165 mysql-5.7.19 \u76ee\u5f55<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ src]# tar zxvf mysql-boost-5.7.19.tar.gz \r\n[root@iZ2864f6btwZ src]# cd mysql-5.7.19\/\r\n<\/code><\/pre>\n<h5>\u65b0\u5efaMySQL\u5b89\u88c5\u6240\u9700\u8981\u76ee\u5f55<\/h5>\n<p><code>[root@iZ2864f6btwZ mysql-5.7.19]# mkdir -p \/usr\/local\/mysql \/usr\/local\/mysql\/{data,logs,pids}<\/code><\/p>\n<h5>\u4fee\u6539 \/usr\/local\/mysql \u76ee\u5f55\u6240\u6709\u8005\u6743\u9650<\/h5>\n<p><code>[root@iZ2864f6btwZ mysql-5.7.19]# chown -R mysql:mysql \/usr\/local\/mysql<\/code><\/p>\n<h5>\u4f7f\u7528cmake\u547d\u4ee4\u8fdb\u884c\u7f16\u8bd1<\/h5>\n<p><code>[root@iZ2864f6btwZ mysql-5.7.19]# cmake . -DCMAKE_INSTALL_PREFIX=\/usr\/local\/mysql -DMYSQL_DATADIR=\/usr\/local\/mysql\/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -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 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=\/usr\/local\/boost<\/code><\/p>\n<div class=\"image-package\"><img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-6b67f04413d890c3.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/620\" alt=\"cmake\u6267\u884c\u5b8c\u7684\u7ed3\u679c\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-6b67f04413d890c3.png?imageMogr2\/auto-orient\/strip\" \/><\/p>\n<div class=\"image-caption\">cmake\u6267\u884c\u5b8c\u7684\u7ed3\u679c<\/div>\n<\/div>\n<h5>\u4f7f\u7528make\u547d\u4ee4\u8fdb\u884c\u7f16\u8bd1\uff0c\u63a5\u4e0b\u6765\u4f60\u5c06\u7ecf\u5386\u6f2b\u957f\u7684\u7b49\u5f85~<\/h5>\n<p><code>[root@iZ2864f6btwZ mysql-5.7.19]# make<\/code><\/p>\n<blockquote><p><strong>\u95ee\u9898\u9519\u8bef\uff1a<\/strong><br \/>\n\u7f16\u8bd1\u51fa\u73b0\u9519\u8bef\uff0c\u67e5\u8be2\u5f97\u77e5\u53ef\u80fd\u662f\u7531\u4e8e\u5185\u5b58\u4e0d\u8db3\u5bfc\u81f4\u7684<\/p>\n<div class=\"image-package\"><img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-0b647b223b6b6164.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/620\" alt=\"c++\u7f16\u8bd1\u51fa\u9519\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-0b647b223b6b6164.png?imageMogr2\/auto-orient\/strip\" \/><\/p>\n<div class=\"image-caption\">c++\u7f16\u8bd1\u51fa\u9519<\/div>\n<\/div>\n<\/blockquote>\n<blockquote><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><br \/>\n\u4e34\u65f6\u589e\u52a0\u4ea4\u6362\u7a7a\u95f4 ( \u865a\u62df\u5185\u5b58 )<\/p>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# dd if=\/dev\/zero of=\/swapfile bs=1k count=2048000\r\n2048000+0 records in\r\n2048000+0 records out\r\n2097152000 bytes (2.1 GB) copied, 34.6782 s, 60.5 MB\/s\r\n[root@iZ2864f6btwZ mysql-5.7.19]# mkswap \/swapfile\r\nSetting up swapspace version 1, size = 2047996 KiB\r\nno label, UUID=56026239-26e6-40d9-b080-b95acd9db058\r\n[root@iZ2864f6btwZ mysql-5.7.19]# swapon \/swapfile\r\nswapon: \/swapfile: insecure permissions 0644, 0600 suggested.\r\n[root@iZ2864f6btwZ mysql-5.7.19]# chmod 600 \/swapfile\r\n<\/code><\/pre>\n<p>\u67e5\u770b\u521b\u5efa\u7684\u4ea4\u6362\u7a7a\u95f4<\/p>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# free -m\r\n             total   used  free  shared  buff\/cache  available\r\nMem:         992     51    70    0       869         789\r\nSwap:        1999    0     1999\r\n<\/code><\/pre>\n<p>\u7ee7\u7eed\u6267\u884c<code>make<\/code>\u547d\u4ee4<\/p>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# make clean\r\n[root@iZ2864f6btwZ mysql-5.7.19]# make\r\n<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u7f16\u8bd1\u5b8c\u6210\u540e\u4e0d\u518d\u60f3\u8981\u6b64\u4ea4\u6362\u7a7a\u95f4\uff0c\u4f60\u53ef\u4ee5\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# swapoff \/swapfile\r\n[root@iZ2864f6btwZ mysql-5.7.19]# rm \/swapfile\r\n<\/code><\/pre>\n<\/blockquote>\n<blockquote><p><strong>\u6e29\u99a8\u63d0\u793a\uff1a<\/strong><br \/>\n<em>MySQL\u7f16\u8bd1\u8fc7\u7a0b\u7b49\u5f85\u65f6\u95f4\u4f1a\u6bd4\u8f83\u4e45\uff0c\u6709\u65f6\u90fd\u4ee5\u4e3a\u662f\u201c\u5361\u201d\u4f4f\u4e86\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>top<\/code>\u547d\u4ee4\u67e5\u770b\u8d44\u6e90\u72b6\u6001\uff0c\u770b\u770bcc1plus\u3001make\u7b49\u8fdb\u7a0b\u662f\u5426\u5728\u8df3\u52a8\uff0c\u5982\u679c\u6709\u8df3\u52a8\u8bf4\u660e\u5b89\u88c5\u8fd8\u5728\u7ee7\u7eed\uff0c\u7531\u4e8e\u6211\u7684 ecs \u914d\u7f6e\u8f83\u4f4e\uff0c\u6b64\u8fc7\u7a0b\u5927\u7ea6\u7ecf\u5386\u4e86\u51e0\u4e2a\u5c0f\u65f6\uff0c\u7279\u522b\u662f\u572829%\u548c74%\u7684\u65f6\u5019\uff0c\u51e0\u4e4e\u90fd\u8981\u5feb\u653e\u5f03\u4e86\uff0c \u5982\u679c\u6709\u7ecf\u6d4e\u7684\u80fd\u529b\u7684\u8bdd\uff0c\u5efa\u8bae\u670d\u52a1\u5668\u914d\u7f6e\u8fd8\u662f\u5c3d\u91cf\u4e70\u9ad8\u4e00\u70b9\u3002<\/em><br \/>\n<code>[root@iZ2864f6btwZ mysql-5.7.19]# top<\/code><\/p><\/blockquote>\n<h5>make\u7f16\u8bd1\u5b8c\u6210<\/h5>\n<div class=\"image-package\"><img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-57fed53328cc82aa.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/620\" alt=\"\u7f16\u8bd1\u5b8c\u6210\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/7351260-57fed53328cc82aa.png?imageMogr2\/auto-orient\/strip\" \/><\/p>\n<div class=\"image-caption\">\u7f16\u8bd1\u5b8c\u6210<\/div>\n<\/div>\n<h5>\u7f16\u8bd1\u5b8c\u6210\u540e\u6267\u884c\u00a0<code>make install<\/code>\u00a0\u8fdb\u884c\u5b89\u88c5<\/h5>\n<p><code>[root@iZ2864f6btwZ mysql-5.7.19]# make install<\/code><\/p>\n<h5>\u5c06mysql\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\uff0c\u4fee\u6539\/etc\/profile\u6587\u4ef6\uff0c\u5728\u6587\u4ef6\u6700\u672b\u5c3e\u6dfb\u52a0<code>export PATH=\/usr\/local\/mysql\/bin:\/usr\/local\/mysql\/lib:$PATH<\/code><\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# vim \/etc\/profile\r\n...\r\nunset i\r\nunset -f pathmunge\r\n# mysql\u6267\u884c\u8def\u5f84\r\nexport PATH=\/usr\/local\/mysql\/bin:\/usr\/local\/mysql\/lib:$PATH\r\n<\/code><\/pre>\n<h5>\u66f4\u65b0\u914d\u7f6e\u6587\u4ef6<\/h5>\n<p><code>[root@iZ2864f6btwZ mysql-5.7.19]# source \/etc\/profile<\/code><\/p>\n<h5>\u521d\u59cb\u5316\u6570\u636e\u5e93\uff0c \u2013initialize \u8868\u793a\u9ed8\u8ba4\u751f\u6210\u4e00\u4e2a\u5b89\u5168\u7684\u5bc6\u7801\uff0c\u2013initialize-insecure \u8868\u793a\u4e0d\u751f\u6210\u5bc6\u7801<\/h5>\n<p><code>[root@iZ2864f6btwZ mysql-5.7.19]# mysqld --initialize-insecure --user=mysql --basedir=\/usr\/local\/mysql --datadir=\/usr\/local\/mysql\/data<\/code><\/p>\n<h5>\u5c06mysql\u670d\u52a1\u6587\u4ef6\u62f7\u8d1d\u5230<code>\/etc\/init.d\/<\/code>\u76ee\u5f55\uff0c\u5e76\u7ed9\u51fa\u6267\u884c\u6743\u9650<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# cp support-files\/mysql.server \/etc\/init.d\/mysqld\r\n[root@iZ2864f6btwZ mysql-5.7.19]# chmod a+x \/etc\/init.d\/mysqld\r\n<\/code><\/pre>\n<h5>\u5c06MySQL\u5e76\u52a0\u5165\u5f00\u673a\u81ea\u52a8\u542f\u52a8<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# chkconfig --add mysqld\r\n[root@iZ2864f6btwZ mysql-5.7.19]# chkconfig mysqld on\r\n[root@iZ2864f6btwZ mysql-5.7.19]# chkconfig --list | grep mysqld\r\n\r\nNote: This output shows SysV services only and does not include native\r\n      systemd services. SysV configuration data might be overridden by native\r\n      systemd configuration.\r\n\r\n      If you want to list systemd services use 'systemctl list-unit-files'.\r\n      To see services enabled on particular target use\r\n      'systemctl list-dependencies [target]'.\r\n\r\nmysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off\r\n<\/code><\/pre>\n<h5>\u4fee\u6539<code>\/etc\/my.cnf<\/code>\u6587\u4ef6\uff0c\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\u5982\u4e0b\uff0c\u4ec5\u4f9b\u53c2\u8003<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# vim \/etc\/my.cnf \r\n\r\n[mysqld]\r\ndatadir=\/usr\/local\/mysql\/data\r\nsocket=\/usr\/local\/mysql\/mysql.sock\r\n\r\n[mysqld_safe]\r\nlog-error=\/usr\/local\/mysql\/logs\/mysqld.log\r\npid-file=\/usr\/local\/mysql\/pids\/mysqld.pid\r\n\r\n# Disabling symbolic-links is recommended to prevent assorted security risks\r\nsymbolic-links=0\r\n# Settings user and group are ignored when systemd is used.\r\n# If you need to run mysqld under a different user or group,\r\n# customize your systemd unit file for mariadb according to the\r\n# instructions in http:\/\/fedoraproject.org\/wiki\/Systemd\r\n\r\n[client]\r\ndefault-character-set=utf8\r\nsocket=\/usr\/local\/mysql\/mysql.sock\r\n\r\n[mysql]\r\ndefault-character-set=utf8\r\nsocket=\/usr\/local\/mysql\/mysql.sock\r\n\r\n#\r\n# include all files from the config directory\r\n#\r\n!includedir \/etc\/my.cnf.d\r\n<\/code><\/pre>\n<h5>\u542f\u52a8MySQL<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ local]# service mysqld start\r\nStarting MySQL.2017-09-23T16:13:16.049373Z mysqld_safe error: log-error set to '\/usr\/local\/mysql\/logs\/mysqld.log', however file don't exists. Create writable for user 'mysql'.\r\nThe server quit without updating PID file (\/usr\/local\/mysql[FAILED]2864f6btwZ.pid).\r\n<\/code><\/pre>\n<blockquote><p><strong>\u95ee\u9898\u9519\u8bef\uff1a<\/strong><br \/>\n\u7531\u4e8e\u7f3a\u5c11\u00a0<code>mysqld.log<\/code>\u00a0\u548c\u00a0<code>mysqld.pid<\/code>\u00a0\u6587\u4ef6\u5bfc\u81f4\u65e0\u6cd5\u6b63\u5e38\u542f\u52a8<\/p><\/blockquote>\n<blockquote><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><br \/>\n\u521b\u5efa\u00a0<code>mysqld.log<\/code>\u00a0\u548c\u00a0<code>mysqld.pid<\/code>\u00a0\u6587\u4ef6<\/p>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# touch \/usr\/local\/mysql\/logs\/mysqld.log\r\n[root@iZ2864f6btwZ mysql-5.7.19]# touch \/usr\/local\/mysql\/pids\/mysqld.pid\r\n<\/code><\/pre>\n<p>\u4fee\u6539 \/usr\/local\/mysql \u7684\u6743\u9650<br \/>\n<code>[root@iZ2864f6btwZ mysql-5.7.19]# chown mysql.mysql -R \/usr\/local\/mysql\/<\/code><\/p>\n<p>\u518d\u6b21\u542f\u52a8MySQL<br \/>\n<code>[root@iZ2864f6btwZ local]# service mysqld start<\/code><\/p><\/blockquote>\n<h5>\u67e5\u770bMySQL\u8fd0\u884c\u72b6\u6001<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ local]# service mysqld status\r\nMySQL is not running, but lock file (\/var\/lock\/subsys\/mysql[FAILED]\r\n<\/code><\/pre>\n<blockquote><p><strong>\u95ee\u9898\u9519\u8bef\uff1a<\/strong><br \/>\n<code>MySQL is not running, but lock file (\/var\/lock\/subsys\/mysql[FAILED]<\/code><\/p><\/blockquote>\n<blockquote><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><br \/>\n\u5220\u9664<code>\/var\/lock\/subsys\/mysql<\/code>\u6587\u4ef6\uff0c\u91cd\u65b0\u542f\u52a8MySQL<\/p>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ local]# rm -f \/var\/lock\/subsys\/mysql\r\n[root@iZ2864f6btwZ local]# service mysqld start\r\nStarting MySQL.                                            [  OK  ]\r\n<\/code><\/pre>\n<\/blockquote>\n<h5>\u8fde\u63a5MySQL<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ mysql-5.7.19]# mysql -u root\r\nERROR 2002 (HY000): Can't connect to local MySQL server through socket '\/tmp\/mysql.sock' (2)\r\n[root@iZ2864f6btwZ mysql-5.7.19]#\r\n<\/code><\/pre>\n<blockquote><p><strong>\u95ee\u9898\u9519\u8bef\uff1a<\/strong><br \/>\n\/etc\/my.cnf \u6587\u4ef6\u914d\u7f6e\u4e0d\u6b63\u786e<br \/>\n<code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '\/tmp\/mysql.sock' (2)<\/code><\/p><\/blockquote>\n<blockquote><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><br \/>\n\u53c2\u8003\u4e0a\u8ff0\u6b65\u9aa4\u00a0<strong>\u4fee\u6539 \/etc\/my.cnf \u6587\u4ef6<\/strong><\/p><\/blockquote>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ local]# mysql -u root\r\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\r\nYour MySQL connection id is 6\r\nServer version: 5.7.19 Source distribution\r\n\r\nCopyright (c) 2000, 2017, Oracle and\/or its affiliates. All rights reserved.\r\n\r\nOracle is a registered trademark of Oracle Corporation and\/or its\r\naffiliates. Other names may be trademarks of their respective\r\nowners.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nmysql&gt;\r\n<\/code><\/pre>\n<h5>\u67e5\u770b\u6570\u636e\u5e93\uff0c\u5982\u679c\u770b\u5230\u4ee5\u4e0b\u51e0\u4e2a\u6570\u636e\u5e93\u8bf4\u660e\u6570\u636e\u5e93\u521d\u59cb\u5316\u6210\u529f<\/h5>\n<pre class=\"hljs undefined\"><code>mysql&gt; show databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n| mysql              |\r\n| performance_schema |\r\n| sys                |\r\n+--------------------+\r\n4 rows in set (0.00 sec)\r\n\r\nmysql&gt;\r\n<\/code><\/pre>\n<h5>\u8fdb\u5165mysql\u5e93\uff0c\u67e5\u770b\u7528\u6237\u8868\u4fe1\u606f<\/h5>\n<pre class=\"hljs undefined\"><code>mysql&gt; use mysql\r\nReading table information for completion of table and column names\r\nYou can turn off this feature to get a quicker startup with -A\r\n\r\nDatabase changed\r\nmysql&gt;\r\nmysql&gt; select host,user,password from user;\r\nERROR 1054 (42S22): Unknown column 'password' in 'field list'\r\nmysql&gt;\r\n<\/code><\/pre>\n<blockquote><p><strong>\u95ee\u9898\u9519\u8bef\uff1a<\/strong><br \/>\n<code>ERROR 1054 (42S22): Unknown column 'password' in 'field list'<\/code><\/p><\/blockquote>\n<blockquote><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><br \/>\n\u7531\u4e8eMySQL 5.7\u7248\u672c\u4e0b\u7684mysql\u6570\u636e\u5e93\u4e0b\u5df2\u7ecf\u6ca1\u6709password\u8fd9\u4e2a\u5b57\u6bb5\u4e86\uff0cpassword\u5b57\u6bb5\u6539\u6210\u4e86authentication_string\uff0c\u67e5\u8be2\u65f6\u4f7f\u7528authentication_string\u5b57\u6bb5\u5373\u53ef<\/p>\n<pre class=\"hljs undefined\"><code>mysql&gt; select host,user,authentication_string from user;\r\n+-----------+---------------+-------------------------------------------+\r\n| host      | user          | authentication_string                     |\r\n+-----------+---------------+-------------------------------------------+\r\n| localhost | root          |                                           |\r\n| localhost | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |\r\n| localhost | mysql.sys     | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |\r\n+-----------+---------------+-------------------------------------------+\r\n3 rows in set (0.00 sec)\r\n<\/code><\/pre>\n<\/blockquote>\n<h5>\u8bbe\u7f6e\u5bc6\u7801\uff08\u63a8\u8350\uff09\uff0c\u6ce8\u610f\u6b64\u65b9\u6cd5\u5fc5\u987b\u4f7f\u7528<code>flush privileges<\/code>\u547d\u4ee4\u5237\u65b0\u4e00\u4e0b\u6743\u9650\u624d\u80fd\u751f\u6548<\/h5>\n<pre class=\"hljs undefined\"><code>mysql&gt; UPDATE user SET authentication_string=PASSWORD('newpassword') WHERE user='root';\r\nQuery OK, 1 row affected, 1 warning (0.00 sec)\r\nRows matched: 1  Changed: 1  Warnings: 1\r\n\r\nmysql&gt;\r\nmysql&gt; flush privileges;\r\nQuery OK, 0 rows affected (0.00 sec)\r\n\r\nmysql&gt;\r\n<\/code><\/pre>\n<h5>\u53e6\u5916\u4e00\u79cd\u65b9\u6cd5\u53ef\u4ee5\u5feb\u901f\u5bc6\u7801\uff0c\u4f46\u6b64\u65b9\u6cd5\u8bbe\u7f6e\u7684\u5bc6\u7801\u4f7f\u7528<code>history<\/code>\u547d\u4ee4\u53ef\u4ee5\u770b\u5230\uff0c\u6240\u4ee5\u4e0d\u592a\u63a8\u8350<\/h5>\n<pre class=\"hljs undefined\"><code>[root@iZ2864f6btwZ ~]# mysqladmin -u root password 'newpassword'\r\nmysqladmin: [Warning] Using a password on the command line interface can be insecure.\r\nWarning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.\r\n<\/code><\/pre>\n<blockquote><p>\u7ed3\u5c3e\uff1a<br \/>\n\u81f3\u6b64\uff0cMySQL 5.7.19 \u7f16\u8bd1\u5b89\u88c5\u53ca\u914d\u7f6e\u5df2\u7ecf\u5168\u90e8\u5b8c\u6210\uff0c\u6709\u7591\u95ee\u7684\u670b\u53cb\u53ef\u4ee5\u7ed9\u6211\u7559\u8a00\uff0c\u82e5\u6709\u6bdb\u75c5\uff0c\u6b22\u8fce\u6307\u6b63\u3002<\/p><\/blockquote>\n<\/div>\n<div class=\"show-foot\"><a class=\"notebook\" href=\"http:\/\/www.jianshu.com\/nb\/15327428\"><i class=\"iconfont ic-search-notebook\"><\/i>\u00a0LNMP<\/a><\/p>\n<div class=\"copyright\" data-toggle=\"tooltip\" data-html=\"true\" data-original-title=\"\u8f6c\u8f7d\u8bf7\u8054\u7cfb\u4f5c\u8005\u83b7\u5f97\u6388\u6743\uff0c\u5e76\u6807\u6ce8\u201c\u7b80\u4e66\u4f5c\u8005\u201d\u3002\">\u00a9 \u8457\u4f5c\u6743\u5f52\u4f5c\u8005\u6240\u6709<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>pijh\u00a0\u5173\u6ce8 2017.09.24 1<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[117],"class_list":["post-751","post","type-post","status-publish","format-standard","hentry","tag-01-linux"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=751"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/751\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}