{"id":2011,"date":"2018-03-23T00:00:57","date_gmt":"2018-03-22T16:00:57","guid":{"rendered":"https:\/\/cloudbool.com\/archive\/?p=383"},"modified":"2018-03-23T00:00:57","modified_gmt":"2018-03-22T16:00:57","slug":"centos-os-yum-repo-instll-mysql-5-5-5-6-5-7-8-0-note","status":"publish","type":"post","link":"https:\/\/cloudbool.com\/archive\/centos-os-yum-repo-instll-mysql-5-5-5-6-5-7-8-0-note.html","title":{"rendered":"CentOS\u7cfb\u7edfyum\u5b89\u88c5MySQL 5.5\/5.6\/5.7\/8.0"},"content":{"rendered":"<p>\u4f5c\u4e3a\u4e00\u4e2aWeb\u5f00\u53d1\u8005\uff0c\u5de5\u4f5c\u65f6\u95f4\u8d8a\u957f\uff0c\u8d8a\u89c9\u5f97\u6570\u636e\u5e93\u76f8\u5173\u77e5\u8bc6\u7684\u91cd\u8981\uff0c\u542c\u8bf4\u4eceMySQL5.7\u5f00\u59cb\uff0c\u5df2\u7ecf\u539f\u751f\u5bf9JSON\u63d0\u4f9b\u4e86\u652f\u6301\uff0c\u6b63\u597d\u60f3\u7cfb\u7edf\u5b66\u4e60\u4e00\u4e0bMySQL\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e8e\u662f\u72e0\u4e0b\u5fc3\u4e70\u4e86\u672cMySQL\u6559\u7a0b\u5b66\u4e60\u4e00\u4e0b\uff0c\u4e66\u4e2d\u4f7f\u7528\u7684\u662fMySQL5.7\uff0c\u4f46\u662f\u6700\u65b0\u7248\u7684CentOS7\u81ea\u5e26\u7684\u662fMariaDB 5.5\uff0c\u8fd8\u4e0d\u662f\u7eaf\u6b63\u7684MySQL\uff0c\u4e5f\u4e0d\u77e5\u9053\u662f\u4e0d\u662f\u5bf9\u5e94\u7684MySQL5.5\uff0c\u6240\u4ee5\u82b1\u4e86\u4e00\u70b9\u65f6\u95f4\u5b66\u4e60\u4e86\u4e00\u4e0bMySQL 5.7\u7684\u5b89\u88c5\uff0c\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\u3002<br \/>\n<!--more--><br \/>\n\u5bf9\u4e8e\u6211\u8fd9\u79cd\u4e0d\u60f3\u6298\u817e\u6e90\u7801\u7f16\u8bd1\u7684\u4eba\u6765\u8bf4\uff0c\u8981\u5b89\u88c5\u4ec0\u4e48\u8f6f\u4ef6\u80af\u5b9a\u662f\u7b2c\u4e00\u65f6\u95f4\u60f3\u5230\u901a\u8fc7\u6e90\u5b89\u88c5\u4e86\uff0cGoogle\u4e86\u4e00\u6ce2\uff0c\u53d1\u73b0\u8fd8\u771f\u80fd\u4ecerepo\u5b89\u88c5MySQL5.7\uff0c\u8fd8\u662fMySQL\u5b98\u65b9\u7684\uff0c\u4e0d\u4ec55.7\uff0c\u8fd8\u80fd\u5b89\u88c55.5\/5.6\/8.0\uff0c\u8fd9\u7b80\u76f4\u826f\u5fc3\u554a\uff0cOracle\u96be\u5f97\u8fd9\u4e48\u826f\u5fc3\u4e00\u6b21\u3002<br \/>\n\u548c\u522b\u7684\u6dfb\u52a0\u7b2c\u4e09\u65b9\u6e90\u5b89\u88c5\u8f6f\u4ef6\u5305\u5dee\u4e0d\u591a\uff0c\u90fd\u662f\u6dfb\u52a0\u6e90\uff0c\u542f\u7528\u6e90\uff0c\u5b89\u88c5\u8f6f\u4ef6\u5305\uff0c\u4f7f\u7528MySQL\u5b98\u65b9\u6e90\u5b89\u88c5MySQL\u4e5f\u4e00\u6837\uff0c\u9996\u5148\u662f\u6dfb\u52a0MySQL\u5b98\u65b9yum\u6e90\uff0c\u6211\u7528\u7684\u6700\u591a\u7684\u662fCentOS7\uff0c\u4e3a\u4e86\u6d4b\u8bd5\u4e24\u8005\u7684\u533a\u522b\uff0c\u6211\u8fd8\u53bb<a href=\"https:\/\/cloudbool.com\/archive\/go\/digitalocean\">Digitalocean<\/a>\u5f00\u4e86\u4e2aDroplet\u6d4b\u8bd5\u4e86\u4e0b\uff0c\u53d1\u73b0\u6dfb\u52a0\u6e90\u4e4b\u540e\uff0c\u4e24\u8005\u90fd\u80fd\u5b89\u88c5MySQL 5.5\/5.6\/5.7\/8.0\uff0c\u4e0d\u5bb9\u6613\u554a\u3002<\/p>\n<h2>CentOS7\u6dfb\u52a0MySQL\u5b98\u65b9yum\u6e90<\/h2>\n<p>\u5176\u5b9e\u4e5f\u5c31\u4e24\u884c\u547d\u4ee4\uff1a<\/p>\n<pre><code>wget https:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-11.noarch.rpm\nyum localinstall mysql57-community-release-el7-11.noarch.rpm\n<\/code><\/pre>\n<h2>CentOS6\u6dfb\u52a0MySQL\u5b98\u65b9yum\u6e90<\/h2>\n<p>\u4e5f\u662f\u4e24\u884c\uff0c\u5c31\u662frpm\u6587\u4ef6\u4e0d\u4e00\u6837\u800c\u5df2\uff1a<\/p>\n<pre><code>wget https:\/\/dev.mysql.com\/get\/mysql57-community-release-el6-11.noarch.rpm\nyum localinstall mysql57-community-release-el6-11.noarch.rpm\n<\/code><\/pre>\n<p>\u4ee5\u4e0a\u4e24\u4e2a\u4e0b\u8f7d\u5730\u5740\u5982\u679c\u6709\u53d8\uff0c\u5230\u8fd9\u91cc\u67e5\u770b\u6700\u65b0\u7684\u5c31\u884c\uff1ahttps:\/\/dev.mysql.com\/downloads\/repo\/yum\/<br \/>\n\u63a5\u4e0b\u6765\u7684\u64cd\u4f5c\u4e24\u4e2a\u7cfb\u7edf\u4e00\u6837\uff0c\u9996\u5148\u662f\u67e5\u770b\u5f53\u524d\u542f\u7528\u7684\u662f\u90a3\u4e2aMySQL\u7248\u672c\u6e90\uff1a<\/p>\n<pre><code>yum repolist enabled | grep \"mysql.*-community.*\"\n<\/code><\/pre>\n<p>\u5982\u679c\u6ca1\u6709\u4fee\u6539\u7684\u8bdd\uff0c\u9ed8\u8ba4\u662fMySQL5.7\uff0c\u8f93\u51fa\u5982\u4e0b\uff1a<\/p>\n<pre><code>[root@elsenow-do-ams3 ~]# yum repolist enabled | grep \"mysql.*-community.*\"\nmysql-connectors-community           MySQL Connectors Community               45\nmysql-tools-community                MySQL Tools Community                    57\nmysql57-community                    MySQL 5.7 Community Server              237\n<\/code><\/pre>\n<h2>\u67e5\u770b\u6240\u6709MySQL\u76f8\u5173\u6e90<\/h2>\n<pre><code>[root@elsenow-do-ams3 ~]# yum repolist all | grep mysql\nmysql-cluster-7.5-community        MySQL Cluster 7.5 Community       \u7981\u7528\nmysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - Sou \u7981\u7528\nmysql-cluster-7.6-community        MySQL Cluster 7.6 Community       \u7981\u7528\nmysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - Sou \u7981\u7528\nmysql-connectors-community         MySQL Connectors Community        \u542f\u7528:    45\nmysql-connectors-community-source  MySQL Connectors Community - Sour \u7981\u7528\nmysql-tools-community              MySQL Tools Community             \u542f\u7528:    57\nmysql-tools-community-source       MySQL Tools Community - Source    \u7981\u7528\nmysql-tools-preview                MySQL Tools Preview               \u7981\u7528\nmysql-tools-preview-source         MySQL Tools Preview - Source      \u7981\u7528\nmysql55-community                  MySQL 5.5 Community Server        \u7981\u7528\nmysql55-community-source           MySQL 5.5 Community Server - Sour \u7981\u7528\nmysql56-community                  MySQL 5.6 Community Server        \u7981\u7528\nmysql56-community-source           MySQL 5.6 Community Server - Sour \u7981\u7528\nmysql57-community                  MySQL 5.7 Community Server        \u542f\u7528:   237\nmysql57-community-source           MySQL 5.7 Community Server - Sour \u7981\u7528\nmysql80-community                  MySQL 8.0 Community Server        \u7981\u7528\nmysql80-community-source           MySQL 8.0 Community Server - Sour \u7981\u7528\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u51fa\uff0c\u4ece5.5\u52308.0\u90fd\u53ef\u4ee5\uff0c\u53ea\u662f\u9ed8\u8ba4\u542f\u7528\u7684\u662f5.7\uff0c\u5982\u679c\u60f3\u5b89\u88c5\u522b\u7684\u7248\u672c\u7684MySQL\uff0c\u7528yum-config-manager\u542f\u7528\u6216\u7981\u7528\u76f8\u5173\u7684\u6e90\u5373\u53ef\uff0c\u6bd4\u5982\u8bf4\u7981\u7528MySQL5.7\u542f\u7528MySQL5.6\uff1a<\/p>\n<pre><code>yum-config-manager --disable mysql57-community\nyum-config-manager --enable mysql56-community\n<\/code><\/pre>\n<p>\u6216\u8005\u4e5f\u53ef\u4ee5\u76f4\u63a5\u7f16\u8f91<strong>\/etc\/yum.repos.d\/mysql-community.repo<\/strong>\u6587\u4ef6\u3002<br \/>\n\u66f4\u6539\u4e4b\u540e\uff0c\u901a\u8fc7\u4e0b\u5217\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u542f\u7528\u7684\u662f\u90a3\u4e2a\u6e90\uff1a<\/p>\n<pre><code>yum repolist enabled | grep mysql\n<\/code><\/pre>\n<p>\u786e\u5b9a\u4e4b\u540e\uff0c\u53ef\u4ee5\u5b89\u88c5MySQL Server\u4e86\uff1a<\/p>\n<pre><code class=\"bash\">yum install mysql-community-server\n<\/code><\/pre>\n<p>\u5b89\u88c5\u8fc7\u7a0b\u5f88\u5feb\uff0c\u5b89\u88c5\u5b8c\u4e4b\u540e\uff0c\u901a\u8fc7\u4e0b\u5217\u547d\u4ee4\u542f\u52a8\uff1a<\/p>\n<pre><code>service mysqld start\n\u6216\u8005\nsystemctl start mysqld\n<\/code><\/pre>\n<p>\u8fd9\u91cc\u6709\u4e00\u70b9\u548c\u4e4b\u524d\u5404\u53d1\u884c\u7248\u4e0d\u4e00\u6837\u7684\u662f\uff0c\u6839\u636eMySQL\u5b98\u65b9\u6587\u6863\uff0cMySQL\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0cMySQL\u4f1a\u4f7f\u7528\u4e00\u4e2a\u968f\u673a\u5bc6\u7801\uff0c\u800c\u4e14<strong>validate_password<\/strong>\u4f1a\u9ed8\u8ba4\u542f\u7528\uff0c\u6240\u4ee5\uff0c\u6211\u4eec\u4e0d\u9700\u8981\u518d\u624b\u52a8\u8bbe\u7f6e\u521d\u59cb\u5bc6\u7801\uff0c\u4e5f\u4e0d\u80fd\u7528\u7a7a\u5bc6\u7801\u767b\u5f55MySQL\u4e86\u3002<br \/>\nMySQL\u521d\u59cb\u5316\u5bc6\u7801\u88ab\u8bb0\u5f55\u5728<strong>\/var\/log\/mysqld.log<\/strong>\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u627e\u5230\uff1a<\/p>\n<pre><code>grep 'temporary password' \/var\/log\/mysqld.log\n<\/code><\/pre>\n<p>\u7136\u540e\u767b\u5f55MySQL\uff1a<\/p>\n<pre><code>mysql -uroot -p\n<\/code><\/pre>\n<p>\u56de\u8f66\u540e\u8f93\u5165\u4e0a\u9762\u67e5\u627e\u5230\u7684\u90a3\u4e2a\u968f\u673a\u5bc6\u7801\uff0c\u5c31\u80fd\u767b\u5f55MySQL\u4e86\u3002<br \/>\n\u4f46\u662f\u767b\u5f55\u4e4b\u540e\u8fd8\u4e0d\u80fd\u7acb\u5373\u8fdb\u884c\u589e\u5220\u6539\u67e5\u64cd\u4f5c\uff0c\u65e0\u8bba\u8f93\u5165\u4ec0\u4e48\uff0c\u90fd\u662f\u63d0\u793a\u4f60\u5148\u66f4\u6539\u5bc6\u7801\uff1a<\/p>\n<pre><code>[root@elsenow-do-ams3 ~]# mysql -uroot -p\nEnter password:\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 6\nServer version: 5.7.21\nCopyright (c) 2000, 2018, Oracle and\/or its affiliates. All rights reserved.\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\nmysql&gt; show databases;\nERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.\nmysql&gt; select mysql;\nERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.\nmysql&gt;\n<\/code><\/pre>\n<p>\u8fd8\u80fd\u8bf4\u4ec0\u4e48\uff0c\u76f4\u63a5\u6539\u5457\uff0c\u66f4\u6539MySQL\u5bc6\u7801\uff1a<\/p>\n<pre><code>ALTER USER 'root'@'localhost' IDENTIFIED BY 'ElseNow123!';\n<\/code><\/pre>\n<p>\u8fd9\u91cc\u6709\u4e00\u70b9\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7531\u4e8evalidate_password\u7684\u5b58\u5728\uff0c\u6240\u66f4\u6539\u7684\u5bc6\u7801\u4e0d\u80fd\u592a\u7b80\u5355\uff0c\u5fc5\u987b\u7b26\u5408validate_password\u8981\u6c42\u624d\u80fd\u66f4\u6539\u6210\u529f\uff0c\u6839\u636e\u5b98\u65b9\u6587\u6863\uff0cMySQL\u5bc6\u7801\u8981\u6c42\u662f\uff1a<\/p>\n<blockquote><p>\n  \u81f3\u5c11\u5305\u542b\u4e00\u4e2a\u5927\u5199\u5b57\u6bcd\uff0c\u4e00\u4e2a\u5c0f\u5199\u5b57\u6bcd\uff0c\u4e00\u4e2a\u6570\u5b57\uff0c\u4e00\u4e2a\u7279\u6b8a\u7b26\u53f7\uff0c\u4e14\u4e0d\u80fd\u5c11\u4e8e8\u4f4d\n<\/p><\/blockquote>\n<p>\u770b\u8fd9\u8981\u6c42\uff0c\u8c8c\u4f3c\u6bd4\u4e4b\u524d\u7684\u7248\u672c\u5bc6\u7801\u8981\u6c42\u662f\u8981\u9ad8\u4e00\u70b9\u4e86\uff0c\u4f46\u662f\u8fd9\u4e5f\u65e0\u53ef\u539a\u975e\uff0cMySQL\u5b98\u65b9\u662f\u51fa\u4e8eMySQL\u670d\u52a1\u5668\u7684\u5b89\u5168\u8003\u8651\uff0c\u6211\u4eec\u8981\u4e48\u6309\u7167\u5b83\u7684\u8981\u6c42\u6765\uff0c\u8981\u4e48\u628avalidate_password\u5173\u95ed\uff0c\u6211\u8fd8\u662f\u5efa\u8bae\u6309\u7167\u5b98\u65b9\u7684\u8981\u6c42\u6765\uff0c\u6bd5\u7adf\u670d\u52a1\u5668\u5b89\u5168\u8981\u7d27\u3002<br \/>\n\u66f4\u6539\u5b8c\u5bc6\u7801\uff0c\u5269\u4e0b\u7684\u64cd\u4f5c\u6211\u76ee\u524d\u6240\u77e5\u7684\u662f\u548c\u4e4b\u524d\u7248\u672c\u4e00\u6837\u4e86\uff0c\u5c31\u6ca1\u4ec0\u4e48\u8bf4\u7684\u4e86\u3002<br \/>\n\u53c2\u8003\u8d44\u6599\uff1a<br \/>\nhttps:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/linux-installation-yum-repo.html<br \/>\nhttps:\/\/dev.mysql.com\/doc\/mysql-repo-excerpt\/5.6\/en\/linux-installation-yum-repo.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u4e3a\u4e00\u4e2aWeb\u5f00\u53d1\u8005\uff0c\u5de5\u4f5c\u65f6\u95f4\u8d8a\u957f\uff0c\u8d8a\u89c9\u5f97\u6570\u636e\u5e93\u76f8\u5173\u77e5\u8bc6\u7684\u91cd\u8981\uff0c\u542c\u8bf4\u4eceMySQL5.7\u5f00\u59cb\uff0c\u5df2\u7ecf\u539f\u751f\u5bf9JSON &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/cloudbool.com\/archive\/centos-os-yum-repo-instll-mysql-5-5-5-6-5-7-8-0-note.html\"> <span class=\"screen-reader-text\">CentOS\u7cfb\u7edfyum\u5b89\u88c5MySQL 5.5\/5.6\/5.7\/8.0<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[183],"tags":[75,222],"class_list":["post-2011","post","type-post","status-publish","format-standard","hentry","category-more","tag-mysql","tag-yum"],"_links":{"self":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/2011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/comments?post=2011"}],"version-history":[{"count":0,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/2011\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/media?parent=2011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/categories?post=2011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/tags?post=2011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}