{"id":6675,"date":"2024-11-14T13:45:18","date_gmt":"2024-11-14T05:45:18","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6675\/"},"modified":"2024-11-14T13:45:18","modified_gmt":"2024-11-14T05:45:18","slug":"centos7%e7%a6%bb%e7%ba%bf%e5%ae%89%e8%a3%85mysql%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6675\/","title":{"rendered":"centos7\u79bb\u7ebf\u5b89\u88c5mysql\u6559\u7a0b"},"content":{"rendered":"<blockquote><p>\n  \u672c\u6559\u7a0b\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728 centos 7 \u7cfb\u7edf\u4e0a\u79bb\u7ebf\u5b89\u88c5 mysql \u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u3002\u79bb\u7ebf\u5b89\u88c5\u9002\u7528\u4e8e\u6ca1\u6709\u4e92\u8054\u7f51\u8fde\u63a5\u7684\u573a\u666f\uff0c\u9700\u8981\u9884\u5148\u4e0b\u8f7d mysql \u5b89\u88c5\u5305\u548c\u6240\u9700\u7684\u4f9d\u8d56\u9879\u3002\u6211\u4eec\u5c06\u4e00\u6b65\u4e00\u6b65\u5730\u6307\u5bfc\u8bfb\u8005\u5982\u4f55\u4e0b\u8f7d\u5fc5\u8981\u7684\u6587\u4ef6\u3001\u914d\u7f6e\u7cfb\u7edf\u73af\u5883\u3001\u5b89\u88c5 mysql \u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\uff0c\u4ee5\u53ca\u5bf9 mysql \u8fdb\u884c\u57fa\u672c\u914d\u7f6e\u3002\u901a\u8fc7\u9075\u5faa\u672c\u6559\u7a0b\uff0c\u5373\u4f7f\u5728\u6ca1\u6709\u4e92\u8054\u7f51\u8fde\u63a5\u7684\u60c5\u51b5\u4e0b\uff0c\u8bfb\u8005\u4e5f\u80fd\u591f\u6210\u529f\u5730\u5b89\u88c5\u548c\u914d\u7f6e mysql\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202410\/17\/2024101714225517957.jpg\" class=\"aligncenter\" title=\"centos7\u79bb\u7ebf\u5b89\u88c5mysql\u6559\u7a0b\u63d2\u56fe\" alt=\"centos7\u79bb\u7ebf\u5b89\u88c5mysql\u6559\u7a0b\u63d2\u56fe\" \/><\/p>\n<p><strong>\u79bb\u7ebf\u5b89\u88c5 MySQL \u4e8e CentOS 7<\/strong><\/p>\n<p><strong>\u4e00\u3001\u524d\u7f6e\u6761\u4ef6<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd CentOS 7 \u7cfb\u7edf\u5df2\u5b89\u88c5\u3002<\/li>\n<li>\u4e0b\u8f7d MySQL \u8f6f\u4ef6\u5305\uff0c\u53ef\u4ece MySQL \u5b98\u65b9\u7f51\u7ad9\u83b7\u53d6\u3002<\/li>\n<\/ul>\n<p><strong>\u4e8c\u3001\u5b89\u88c5\u6b65\u9aa4<\/strong><\/p>\n<p><strong>1. \u4e0a\u4f20 MySQL \u8f6f\u4ef6\u5305<\/strong><\/p>\n<ul>\n<li>\u5c06\u4e0b\u8f7d\u7684 MySQL \u8f6f\u4ef6\u5305\u4e0a\u4f20\u5230 CentOS 7 \u670d\u52a1\u5668\u4e0a\u3002<\/li>\n<\/ul>\n<p><strong>2. \u5b89\u88c5\u4f9d\u8d56\u9879<\/strong><\/p>\n<ul>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 MySQL \u9700\u8981\u7684\u4f9d\u8d56\u9879\uff1a<\/li>\n<\/ul>\n<pre>sudo yum install perl-Data-Dumper perl-JSON openssl<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u521b\u5efa MySQL \u7528\u6237\u548c\u7ec4<\/strong><\/p>\n<ul>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa MySQL \u7528\u6237\u548c\u7ec4\uff1a<\/li>\n<\/ul>\n<pre>sudo groupadd mysql\nsudo useradd -g mysql mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u89e3\u538b MySQL \u8f6f\u4ef6\u5305<\/strong><\/p>\n<ul>\n<li>\u89e3\u538b\u4e0b\u8f7d\u7684 MySQL \u8f6f\u4ef6\u5305\uff1a<\/li>\n<\/ul>\n<pre>sudo tar -xvf mysql-*.tar.gz<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u79fb\u52a8 MySQL \u6587\u4ef6<\/strong><\/p>\n<ul>\n<li>\u5c06\u89e3\u538b\u540e\u7684 MySQL \u6587\u4ef6\u79fb\u52a8\u5230\u76ee\u6807\u76ee\u5f55\uff1a<\/li>\n<\/ul>\n<pre>sudo mv mysql-*\/ \/usr\/local\/mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u6388\u4e88\u6743\u9650<\/strong><\/p>\n<ul>\n<li>\u5c06 MySQL \u76ee\u5f55\u7684\u6240\u6709\u6743\u548c\u6743\u9650\u6388\u4e88  \u7528\u6237\u548c\u7ec4\uff1a<\/li>\n<\/ul>\n<pre>sudo chown -R mysql:mysql \/usr\/local\/mysql\nchmod -R 755 \/usr\/local\/mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>7. \u521d\u59cb\u5316 MySQL<\/strong><\/p>\n<ul>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u521d\u59cb\u5316 MySQL \u6570\u636e\u5e93\uff1a<\/li>\n<\/ul>\n<pre>sudo \/usr\/local\/mysql\/bin\/mysqld --initialize-insecure --user=mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>8. \u542f\u52a8 MySQL \u670d\u52a1<\/strong><\/p>\n<ul>\n<li>\u542f\u52a8 MySQL \u670d\u52a1\uff1a<\/li>\n<\/ul>\n<pre>sudo \/usr\/local\/mysql\/support-files\/mysql.server start<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4e09\u3001\u914d\u7f6e MySQL<\/strong><\/p>\n<p><strong>1. \u521b\u5efa root \u5bc6\u7801<\/strong><\/p>\n<ul>\n<li>\u8fde\u63a5\u5230 MySQL \u6570\u636e\u5e93\u5e76\u521b\u5efa root \u5bc6\u7801\uff1a<\/li>\n<\/ul>\n<pre>sudo \/usr\/local\/mysql\/bin\/mysql -uroot<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<blockquote>\n<p>MySQL \u547d\u4ee4\u63d0\u793a\u7b26\u4e0b\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('\u4f60\u7684\u5bc6\u7801');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236\n<\/p><\/blockquote>\n<p><strong>2. \u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u9700\u8981\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\u5230 MySQL \u6570\u636e\u5e93\uff0c\u8bf7\u7f16\u8f91 \/etc\/my.cnf \u6587\u4ef6\uff0c\u5728 [mysqld] \u90e8\u5206\u4e0b\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/li>\n<\/ul>\n<pre>bind-address=0.0.0.0<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u91cd\u542f MySQL \u670d\u52a1<\/strong><\/p>\n<ul>\n<li>\u91cd\u542f MySQL \u670d\u52a1\u4ee5\u5e94\u7528\u914d\u7f6e\u66f4\u6539\uff1a<\/li>\n<\/ul>\n<pre>sudo \/usr\/local\/mysql\/support-files\/mysql.server restart<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f7\u79bb\u7ebf\u6559\u7a0b\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\u6559\u7a0b\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728 centos 7 \u7cfb\u7edf\u4e0a\u79bb\u7ebf\u5b89\u88c5 mysql \u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u3002\u79bb\u7ebf\u5b89\u88c5\u9002\u7528\u4e8e\u6ca1\u6709\u4e92\u8054\u7f51\u8fde\u63a5\u7684\u573a\u666f\uff0c\u9700\u8981\u9884\u5148\u4e0b\u8f7d mysql \u5b89\u88c5\u5305\u548c\u6240\u9700\u7684\u4f9d\u8d56\u9879\u3002\u6211\u4eec\u5c06\u4e00\u6b65\u4e00\u6b65\u5730\u6307\u5bfc\u8bfb\u8005\u5982\u4f55\u4e0b\u8f7d\u5fc5\u8981\u7684\u6587\u4ef6\u3001\u914d\u7f6e\u7cfb\u7edf\u73af\u5883\u3001\u5b89\u88c5 mysql \u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\uff0c\u4ee5\u53ca\u5bf9 mysql \u8fdb\u884c\u57fa\u672c\u914d\u7f6e\u3002\u901a\u8fc7\u9075\u5faa\u672c\u6559\u7a0b\uff0c\u5373\u4f7f\u5728\u6ca1\u6709\u4e92\u8054\u7f51\u8fde\u63a5\u7684\u60c5\u51b5\u4e0b\uff0c\u8bfb\u8005\u4e5f\u80fd\u591f\u6210\u529f\u5730\u5b89\u88c5\u548c\u914d\u7f6e mysql\u3002 \u79bb\u7ebf\u5b89\u88c5 MySQL \u4e8e CentOS 7 \u4e00\u3001\u524d\u7f6e\u6761\u4ef6 \u786e\u4fdd CentOS 7 \u7cfb\u7edf\u5df2\u5b89\u88c5\u3002 \u4e0b\u8f7d MySQL \u8f6f\u4ef6\u5305\uff0c\u53ef\u4ece MySQL \u5b98\u65b9\u7f51\u7ad9\u83b7\u53d6\u3002 \u4e8c\u3001\u5b89\u88c5\u6b65\u9aa4 1. \u4e0a\u4f20 MySQL \u8f6f\u4ef6\u5305 \u5c06\u4e0b\u8f7d\u7684 MySQL \u8f6f\u4ef6\u5305\u4e0a\u4f20\u5230 CentOS 7 \u670d\u52a1\u5668\u4e0a\u3002 2. \u5b89\u88c5\u4f9d\u8d56\u9879 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 MySQL \u9700\u8981\u7684\u4f9d\u8d56\u9879\uff1a sudo yum install perl-Data-Dumper perl-JSON openssl \u767b\u5f55\u540e\u590d\u5236 3. \u521b\u5efa MySQL \u7528\u6237\u548c\u7ec4 [&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-6675","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6675","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=6675"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6675\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}