{"id":42748,"date":"2024-10-04T02:11:44","date_gmt":"2024-10-03T18:11:44","guid":{"rendered":"https:\/\/server.hk\/cnblog\/42748\/"},"modified":"2024-10-04T02:11:44","modified_gmt":"2024-10-03T18:11:44","slug":"centos-7-%e5%ae%89%e8%a3%9d-mysql-5-6-%e9%81%87%e5%88%b0%e5%95%8f%e9%a1%8c%e5%8f%8a%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/42748\/","title":{"rendered":"CentOS 7 \u5b89\u88dd MySQL 5.6 \u9047\u5230\u554f\u984c\u53ca\u89e3\u6c7a\u65b9\u6848"},"content":{"rendered":"<h1 id=\"centos-7-%e5%ae%89%e8%a3%9d-mysql-5-6-%e9%81%87%e5%88%b0%e5%95%8f%e9%a1%8c%e5%8f%8a%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88-hiGZpXoKoR\">CentOS 7 \u5b89\u88dd MySQL 5.6 \u9047\u5230\u554f\u984c\u53ca\u89e3\u6c7a\u65b9\u6848<\/h1>\n<p>\u5728 CentOS 7 \u4e0a\u5b89\u88dd MySQL 5.6 \u662f\u4e00\u500b\u5e38\u898b\u7684\u9700\u6c42\uff0c\u5c24\u5176\u662f\u5728\u9700\u8981\u7a69\u5b9a\u6027\u548c\u6027\u80fd\u7684\u74b0\u5883\u4e2d\u3002\u7136\u800c\uff0c\u5728\u5b89\u88dd\u904e\u7a0b\u4e2d\uff0c\u4f7f\u7528\u8005\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u554f\u984c\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u4e00\u4e9b\u5e38\u898b\u7684\u554f\u984c\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\uff0c\u5e6b\u52a9\u60a8\u9806\u5229\u5b8c\u6210\u5b89\u88dd\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d%e5%89%8d%e7%9a%84%e6%ba%96%e5%82%99-hiGZpXoKoR\">\u5b89\u88dd\u524d\u7684\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd MySQL 5.6 \u4e4b\u524d\uff0c\u5efa\u8b70\u60a8\u5148\u66f4\u65b0\u7cfb\u7d71\uff0c\u4ee5\u78ba\u4fdd\u6240\u6709\u7684\u5305\u90fd\u662f\u6700\u65b0\u7684\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u5fc5\u8981\u7684\u4f9d\u8cf4\u5305\uff1a<\/p>\n<pre><code>sudo yum install -y wget<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-mysql-5-6-hiGZpXoKoR\">\u5b89\u88dd MySQL 5.6<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5f9e MySQL \u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09 MySQL 5.6 \u7684 RPM \u5305\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>wget https:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-11.noarch.rpm<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u5b89\u88dd\u4e0b\u8f09\u7684 RPM \u5305\uff1a<\/p>\n<pre><code>sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u7981\u7528 MySQL 5.7 \u7684\u5b58\u5132\u5eab\uff0c\u4e26\u555f\u7528 MySQL 5.6 \u7684\u5b58\u5132\u5eab\uff1a<\/p>\n<pre><code>sudo yum-config-manager --disable mysql57-community<\/code><\/pre>\n<pre><code>sudo yum-config-manager --enable mysql56-community<\/code><\/pre>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u5b89\u88dd MySQL 5.6\uff1a<\/p>\n<pre><code>sudo yum install -y mysql-community-server<\/code><\/pre>\n<h2 id=\"%e5%b8%b8%e8%a6%8b%e5%95%8f%e9%a1%8c%e5%8f%8a%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88-hiGZpXoKoR\">\u5e38\u898b\u554f\u984c\u53ca\u89e3\u6c7a\u65b9\u6848<\/h2>\n<h3 id=\"%e5%95%8f%e9%a1%8c-1%ef%bc%9a%e5%ae%89%e8%a3%9d%e9%81%8e%e7%a8%8b%e4%b8%ad%e5%87%ba%e7%8f%be%e4%be%9d%e8%b3%b4%e6%80%a7%e9%8c%af%e8%aa%a4-hiGZpXoKoR\">\u554f\u984c 1\uff1a\u5b89\u88dd\u904e\u7a0b\u4e2d\u51fa\u73fe\u4f9d\u8cf4\u6027\u932f\u8aa4<\/h3>\n<p>\u5728\u5b89\u88dd MySQL 5.6 \u6642\uff0c\u60a8\u53ef\u80fd\u6703\u9047\u5230\u4f9d\u8cf4\u6027\u932f\u8aa4\u3002\u9019\u901a\u5e38\u662f\u56e0\u70ba\u7cfb\u7d71\u4e2d\u7f3a\u5c11\u67d0\u4e9b\u5fc5\u8981\u7684\u5305\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6aa2\u67e5\u7f3a\u5c11\u7684\u4f9d\u8cf4\u5305\uff1a<\/p>\n<pre><code>sudo yum deplist mysql-community-server<\/code><\/pre>\n<p>\u6839\u64da\u8f38\u51fa\u7684\u4fe1\u606f\uff0c\u624b\u52d5\u5b89\u88dd\u7f3a\u5c11\u7684\u4f9d\u8cf4\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>sudo yum install <\/code><\/pre>\n<h3 id=\"%e5%95%8f%e9%a1%8c-2%ef%bc%9amysql-%e6%9c%8d%e5%8b%99%e7%84%a1%e6%b3%95%e5%95%9f%e5%8b%95-hiGZpXoKoR\">\u554f\u984c 2\uff1aMySQL \u670d\u52d9\u7121\u6cd5\u555f\u52d5<\/h3>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u53ef\u80fd\u6703\u767c\u73fe MySQL \u670d\u52d9\u7121\u6cd5\u555f\u52d5\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u670d\u52d9\u72c0\u614b\uff1a<\/p>\n<pre><code>sudo systemctl status mysqld<\/code><\/pre>\n<p>\u5982\u679c\u670d\u52d9\u672a\u555f\u52d5\uff0c\u60a8\u53ef\u4ee5\u67e5\u770b\u65e5\u8a8c\u6587\u4ef6\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\uff1a<\/p>\n<pre><code>sudo journalctl -xe<\/code><\/pre>\n<p>\u5e38\u898b\u7684\u539f\u56e0\u5305\u62ec\u914d\u7f6e\u6587\u4ef6\u932f\u8aa4\u6216\u7aef\u53e3\u885d\u7a81\u3002\u6aa2\u67e5 \/etc\/my.cnf \u6587\u4ef6\uff0c\u78ba\u4fdd\u914d\u7f6e\u6b63\u78ba\u3002<\/p>\n<h3 id=\"%e5%95%8f%e9%a1%8c-3%ef%bc%9a%e7%84%a1%e6%b3%95%e9%80%a3%e6%8e%a5%e5%88%b0-mysql-hiGZpXoKoR\">\u554f\u984c 3\uff1a\u7121\u6cd5\u9023\u63a5\u5230 MySQL<\/h3>\n<p>\u5982\u679c\u60a8\u80fd\u5920\u555f\u52d5 MySQL\uff0c\u4f46\u7121\u6cd5\u9023\u63a5\uff0c\u8acb\u6aa2\u67e5\u9632\u706b\u7246\u8a2d\u7f6e\u3002\u78ba\u4fdd MySQL \u7684\u9ed8\u8a8d\u7aef\u53e3 3306 \u5df2\u7d93\u958b\u653e\uff1a<\/p>\n<pre><code>sudo firewall-cmd --permanent --add-port=3306\/tcp<\/code><\/pre>\n<pre><code>sudo firewall-cmd --reload<\/code><\/pre>\n<p>\u6b64\u5916\uff0c\u6aa2\u67e5 MySQL \u7684\u7528\u6236\u6b0a\u9650\uff0c\u78ba\u4fdd\u60a8\u4f7f\u7528\u7684\u7528\u6236\u6709\u6b0a\u8a2a\u554f\u6578\u64da\u5eab\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-hiGZpXoKoR\">\u7e3d\u7d50<\/h2>\n<p>\u5728 CentOS 7 \u4e0a\u5b89\u88dd MySQL 5.6 \u53ef\u80fd\u6703\u9047\u5230\u4e00\u4e9b\u6311\u6230\uff0c\u4f46\u901a\u904e\u4e0a\u8ff0\u6b65\u9a5f\u548c\u89e3\u6c7a\u65b9\u6848\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u9806\u5229\u5b8c\u6210\u5b89\u88dd\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u670d\u52d9\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u61c9\u7528\u63d0\u4f9b\u7a69\u5b9a\u7684\u74b0\u5883\u548c\u66f4\u597d\u7684\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22\u5728 CentOS 7 \u4e0a\u5b89\u88dd MySQL 5.6 \u9047\u5230\u7684\u5e38\u898b\u554f\u984c\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\uff0c\u52a9\u60a8\u9806\u5229\u5b8c\u6210\u5b89\u88dd\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-42748","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=42748"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42748\/revisions"}],"predecessor-version":[{"id":42749,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42748\/revisions\/42749"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=42748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=42748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=42748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}