{"id":6673,"date":"2024-11-14T11:56:18","date_gmt":"2024-11-14T03:56:18","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6673\/"},"modified":"2024-11-14T11:56:18","modified_gmt":"2024-11-14T03:56:18","slug":"centos7%e5%ae%89%e8%a3%85mysql%e7%9a%84%e8%af%a6%e7%bb%86%e6%95%99%e7%a8%8b%ef%bc%882025%ef%bc%89","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6673\/","title":{"rendered":"CentOS7\u5b89\u88c5MYSQL\u7684\u8be6\u7ec6\u6559\u7a0b\uff082025\uff09"},"content":{"rendered":"<blockquote><p>\n  \u672c\u6587\u63d0\u4f9b\u4e86\u5728 centos 7 \u7cfb\u7edf\u4e0a\u5b89\u88c5 mysql \u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u7684\u8be6\u7ec6\u6307\u5357\u3002\u5b83\u5206\u6b65\u4ecb\u7ecd\u4e86\u5982\u4f55\u4e0b\u8f7d\u3001\u5b89\u88c5\u548c\u914d\u7f6e mysql\uff0c\u5305\u62ec\u8bbe\u7f6e root \u7528\u6237\u5bc6\u7801\u3001\u521b\u5efa\u6570\u636e\u5e93\u548c\u7528\u6237\uff0c\u4ee5\u53ca\u5bfc\u5165\u548c\u5bfc\u51fa\u6570\u636e\u3002\u672c\u6587\u63d0\u4f9b\u4e86\u547d\u4ee4\u884c\u6307\u4ee4\u548c\u8be6\u7ec6\u7684\u8bf4\u660e\uff0c\u9002\u5408\u521d\u5b66\u8005\u548c\u6709\u7ecf\u9a8c\u7684\u7cfb\u7edf\u7ba1\u7406\u5458\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202410\/17\/2024101714175016720.jpg\" class=\"aligncenter\" title=\"CentOS7\u5b89\u88c5MYSQL\u7684\u8be6\u7ec6\u6559\u7a0b\uff082025\uff09\u63d2\u56fe\" alt=\"CentOS7\u5b89\u88c5MYSQL\u7684\u8be6\u7ec6\u6559\u7a0b\uff082025\uff09\u63d2\u56fe\" \/><\/p>\n<h2>CentOS 7 \u5b89\u88c5 MySQL \u8be6\u7ec6\u6559\u7a0b<\/h2>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u6b65\u9aa4 1\uff1a\u68c0\u67e5 CentOS \u7248\u672c<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u786e\u8ba4\u4f60\u7684 CentOS \u7248\u672c\u662f 7 \u6216\u66f4\u9ad8\uff1a<\/p>\n<pre>cat&nbsp;\/etc\/centos-release<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u6b65\u9aa4 2\uff1a\u542f\u7528 MySQL \u5b58\u50a8\u5e93<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u6dfb\u52a0 MySQL Yum \u5b58\u50a8\u5e93\uff1a<\/p>\n<pre>sudo&nbsp;yum&nbsp;install&nbsp;https:\/\/dev.mysql.com\/get\/mysql80-community-release-el7-1.noarch.rpm<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u6b65\u9aa4 3\uff1a\u5b89\u88c5 MySQL<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u66f4\u65b0 Yum \u5b58\u50a8\u5e93\u5e76\u5b89\u88c5 MySQL \u670d\u52a1\uff1a<\/p>\n<pre>sudo&nbsp;yum&nbsp;-y&nbsp;update\nsudo&nbsp;yum&nbsp;-y&nbsp;install&nbsp;mysql-community-server<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u6b65\u9aa4 4\uff1a\u542f\u52a8 MySQL \u670d\u52a1<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u542f\u52a8 MySQL \u670d\u52a1\u5e76\u5c06\u5176\u914d\u7f6e\u4e3a\u5f00\u673a\u81ea\u542f\u52a8\uff1a<\/p>\n<pre>sudo&nbsp;systemctl&nbsp;start&nbsp;mysqld\nsudo&nbsp;systemctl&nbsp;enable&nbsp;mysqld<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u6b65\u9aa4 5\uff1a\u521b\u5efa root \u5bc6\u7801<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;_secure_installation&nbsp;\u811a\u672c\u521b\u5efa MySQL root \u5bc6\u7801\uff1a<\/p>\n<pre>sudo&nbsp;mysql_secure_installation<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u6b65\u9aa4 6\uff1a\u767b\u5f55 MySQL<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528 root \u5bc6\u7801\u767b\u5f55 MySQL\uff1a<\/p>\n<pre>mysql&nbsp;-u&nbsp;root&nbsp;-p<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u6b65\u9aa4 7\uff1a\u521b\u5efa\u6570\u636e\u5e93\u548c\u7528\u6237<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u521b\u5efa\u793a\u4f8b\u6570\u636e\u5e93&nbsp;my_db&nbsp;\u548c\u7528\u6237&nbsp;my_user\uff1a<\/p>\n<pre>CREATE&nbsp;DATABASE&nbsp;my_db;\nCREATE&nbsp;USER&nbsp;my_user@localhost&nbsp;IDENTIFIED&nbsp;BY&nbsp;'my_password';\nGRANT&nbsp;ALL&nbsp;PRIVILEGES&nbsp;ON&nbsp;my_db.*&nbsp;to&nbsp;my_user@localhost;\nFLUSH&nbsp;PRIVILEGES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u6b65\u9aa4 8\uff1a\u9000\u51fa\u5e76\u6d4b\u8bd5\u8fde\u63a5<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u9000\u51fa MySQL \u5e76\u91cd\u65b0\u8fde\u63a5\u4ee5\u6d4b\u8bd5\u914d\u7f6e\uff1a<\/p>\n<pre>exit\nmysql&nbsp;-u&nbsp;my_user&nbsp;-pmy_password&nbsp;-Dmy_db<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u5982\u679c\u6210\u529f\u8fde\u63a5\uff0c\u5219 MySQL \u5b89\u88c5\u5b8c\u6210\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fCentOS7\u5b89\u88c5MYSQL\u7684\u8be6\u7ec6\u6559\u7a0b\uff082025\uff09\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u63d0\u4f9b\u4e86\u5728 centos 7 \u7cfb\u7edf\u4e0a\u5b89\u88c5 mysql \u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u7684\u8be6\u7ec6\u6307\u5357\u3002\u5b83\u5206\u6b65\u4ecb\u7ecd\u4e86\u5982\u4f55\u4e0b\u8f7d\u3001\u5b89\u88c5\u548c\u914d\u7f6e mysql\uff0c\u5305\u62ec\u8bbe\u7f6e root \u7528\u6237\u5bc6\u7801\u3001\u521b\u5efa\u6570\u636e\u5e93\u548c\u7528\u6237\uff0c\u4ee5\u53ca\u5bfc\u5165\u548c\u5bfc\u51fa\u6570\u636e\u3002\u672c\u6587\u63d0\u4f9b\u4e86\u547d\u4ee4\u884c\u6307\u4ee4\u548c\u8be6\u7ec6\u7684\u8bf4\u660e\uff0c\u9002\u5408\u521d\u5b66\u8005\u548c\u6709\u7ecf\u9a8c\u7684\u7cfb\u7edf\u7ba1\u7406\u5458\u3002 CentOS 7 \u5b89\u88c5 MySQL \u8be6\u7ec6\u6559\u7a0b \u6b65\u9aa4 1\uff1a\u68c0\u67e5 CentOS \u7248\u672c \u786e\u8ba4\u4f60\u7684 CentOS \u7248\u672c\u662f 7 \u6216\u66f4\u9ad8\uff1a cat&nbsp;\/etc\/centos-release \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 2\uff1a\u542f\u7528 MySQL \u5b58\u50a8\u5e93 \u6dfb\u52a0 MySQL Yum \u5b58\u50a8\u5e93\uff1a sudo&nbsp;yum&nbsp;install&nbsp;https:\/\/dev.mysql.com\/get\/mysql80-community-release-el7-1.noarch.rpm \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 3\uff1a\u5b89\u88c5 MySQL \u66f4\u65b0 Yum \u5b58\u50a8\u5e93\u5e76\u5b89\u88c5 MySQL \u670d\u52a1\uff1a sudo&nbsp;yum&nbsp;-y&nbsp;update sudo&nbsp;yum&nbsp;-y&nbsp;install&nbsp;mysql-community-server \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 4\uff1a\u542f\u52a8 MySQL \u670d\u52a1 \u542f\u52a8 MySQL \u670d\u52a1\u5e76\u5c06\u5176\u914d\u7f6e\u4e3a\u5f00\u673a\u81ea\u542f\u52a8\uff1a sudo&nbsp;systemctl&nbsp;start&nbsp;mysqld sudo&nbsp;systemctl&nbsp;enable&nbsp;mysqld [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6673","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6673"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6673\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}