{"id":6677,"date":"2024-11-14T09:10:57","date_gmt":"2024-11-14T01:10:57","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6677\/"},"modified":"2024-11-14T09:10:57","modified_gmt":"2024-11-14T01:10:57","slug":"linux-mysql%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e6%95%99%e7%a8%8b-linux%e4%b8%admysql%e6%9c%80%e6%96%b0%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6677\/","title":{"rendered":"Linux mysql\u5b89\u88c5\u914d\u7f6e\u6559\u7a0b linux\u4e2dmysql\u6700\u65b0\u5b89\u88c5\u914d\u7f6e\u6559\u7a0b"},"content":{"rendered":"<blockquote><p>\n  \u672c\u7bc7\u6587\u7ae0\u63d0\u4f9b\u4e86\u5728 linux \u7cfb\u7edf\u4e2d\u5b89\u88c5\u548c\u914d\u7f6e mysql \u6570\u636e\u5e93\u7684\u8be6\u7ec6\u6559\u7a0b\u3002\u8be5\u6559\u7a0b\u9002\u7528\u4e8e\u5e0c\u671b\u5728 linux \u670d\u52a1\u5668\u6216\u4e2a\u4eba\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c mysql \u6570\u636e\u5e93\u7684\u7528\u6237\uff0c\u6db5\u76d6\u4ece\u5b89\u88c5 mysql \u8f6f\u4ef6\u5305\u5230\u914d\u7f6e\u670d\u52a1\u5668\u548c\u6570\u636e\u5e93\u5b9e\u4f8b\u7684\u5404\u4e2a\u6b65\u9aa4\u3002\u901a\u8fc7\u9075\u5faa\u672c\u6559\u7a0b\u4e2d\u7684\u8bf4\u660e\uff0c\u8bfb\u8005\u5c06\u80fd\u591f\u5728 linux \u7cfb\u7edf\u4e2d\u6210\u529f\u8bbe\u7f6e\u5e76\u4f7f\u7528 mysql \u6570\u636e\u5e93\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202410\/17\/2024101714321615484.jpg\" class=\"aligncenter\" title=\"Linux mysql\u5b89\u88c5\u914d\u7f6e\u6559\u7a0b linux\u4e2dmysql\u6700\u65b0\u5b89\u88c5\u914d\u7f6e\u6559\u7a0b\u63d2\u56fe\" alt=\"Linux mysql\u5b89\u88c5\u914d\u7f6e\u6559\u7a0b linux\u4e2dmysql\u6700\u65b0\u5b89\u88c5\u914d\u7f6e\u6559\u7a0b\u63d2\u56fe\" \/><\/p>\n<h2>Linux MySQL \u5b89\u88c5\u4e0e\u914d\u7f6e\u6559\u7a0b<\/h2>\n<h3>1. \u68c0\u67e5 <\/h3>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u786e\u8ba4\u7cfb\u7edf\u7248\u672c\u662f\u5426\u6ee1\u8db3 MySQL \u7684\u6700\u4f4e\u8981\u6c42\u3002\u5bf9\u4e8e\u5927\u591a\u6570\u7248\u672c\uff0c\u63a8\u8350\u4f7f\u7528 Ubuntu \u6216 CentOS\u3002<\/p>\n<h3>2. \u5bfc\u5165 MySQL \u5b58\u50a8\u5e93<\/h3>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>Ubuntu<\/strong><\/p>\n<pre>sudo&nbsp;apt-get&nbsp;install&nbsp;software-properties-common\nsudo&nbsp;add-apt-repository&nbsp;'deb&nbsp;[arch=amd64]&nbsp;http:\/\/dev.mysql.com\/get\/mysql-apt\/&nbsp;stable&nbsp;mysql-apt-config'\nsudo&nbsp;apt-get&nbsp;update<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>CentOS<\/strong><\/p>\n<pre>wget&nbsp;http:\/\/repo.mysql.com\/mysql-community-release-el7-5.noarch.rpm\nsudo&nbsp;yum&nbsp;localinstall&nbsp;mysql-community-release-el7-5.noarch.rpm\nsudo&nbsp;yum&nbsp;update<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>3. \u5b89\u88c5 MySQL<\/h3>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>Ubuntu<\/strong><\/p>\n<pre>sudo&nbsp;apt-get&nbsp;install&nbsp;mysql-server<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>CentOS<\/strong><\/p>\n<pre>sudo&nbsp;yum&nbsp;install&nbsp;mysql-community-server<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>4. \u542f\u52a8 MySQL \u670d\u52a1<\/h3>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>Ubuntu<\/strong><\/p>\n<pre>sudo&nbsp;systemctl&nbsp;start&nbsp;mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>CentOS<\/strong><\/p>\n<pre>sudo&nbsp;systemctl&nbsp;start&nbsp;mysqld<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>5. \u5b89\u5168 MySQL \u5b89\u88c5<\/h3>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>Ubuntu<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">sudo _secure_installation<\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>CentOS<\/strong><\/p>\n<pre>sudo&nbsp;\/usr\/bin\/mysql_secure_installation<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>6. \u521b\u5efa\u6570\u636e\u5e93\u548c\u7528\u6237<\/h3>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u4f7f\u7528 MySQL \u5ba2\u6237\u673a\uff08Ubuntu \u548c CentOS\uff09<\/strong><\/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:\">root&nbsp;\u662f MySQL \u9ed8\u8ba4\u7ba1\u7406\u5458\u7528\u6237\uff0c\u60a8\u9700\u8981\u8f93\u5165\u8bbe\u7f6e\u7684\u5bc6\u7801\u3002<\/p>\n<h3>7. \u6388\u4e88\u7528\u6237\u6743\u9650<\/h3>\n<pre>CREATE&nbsp;DATABASE&nbsp;my_database;\nGRANT&nbsp;ALL&nbsp;PRIVILEGES&nbsp;ON&nbsp;my_database.*&nbsp;TO&nbsp;'my_user'@'localhost'&nbsp;IDENTIFIED&nbsp;BY&nbsp;'my_password';\nFLUSH&nbsp;PRIVILEGES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>8. \u8fde\u63a5\u5230\u6570\u636e\u5e93<\/h3>\n<pre>mysql&nbsp;-u&nbsp;my_user&nbsp;-p&nbsp;my_database<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u8f93\u5165\u5bc6\u7801\u8fde\u63a5\u5230\u521b\u5efa\u7684\u6570\u636e\u5e93\u3002<\/p>\n<h3>9. \u5378\u8f7d MySQL<\/h3>\n<ul>\n<li>\n<p style=\"margin-top: 0px;margin-bottom: 9px\"><strong>Ubuntu<\/strong><\/p>\n<pre>sudo&nbsp;apt-get&nbsp;remove&nbsp;mysql-server\nsudo&nbsp;apt-get&nbsp;purge&nbsp;mysql-server\nsudo&nbsp;rm&nbsp;-rf&nbsp;\/var\/lib\/mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p style=\"margin-top: 0px;margin-bottom: 9px\"><strong>CentOS<\/strong><\/p>\n<pre>sudo&nbsp;yum&nbsp;remove&nbsp;mysql-community-server\nyum&nbsp;clean&nbsp;all\nsudo&nbsp;rm&nbsp;-rf&nbsp;\/var\/lib\/mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fLinux \u5b89\u88c5\u914d\u7f6e\u6559\u7a0b \u4e2dmysql\u6700\u65b0\u5b89\u88c5\u914d\u7f6e\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\u7bc7\u6587\u7ae0\u63d0\u4f9b\u4e86\u5728 linux \u7cfb\u7edf\u4e2d\u5b89\u88c5\u548c\u914d\u7f6e mysql \u6570\u636e\u5e93\u7684\u8be6\u7ec6\u6559\u7a0b\u3002\u8be5\u6559\u7a0b\u9002\u7528\u4e8e\u5e0c\u671b\u5728 linux \u670d\u52a1\u5668\u6216\u4e2a\u4eba\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c mysql \u6570\u636e\u5e93\u7684\u7528\u6237\uff0c\u6db5\u76d6\u4ece\u5b89\u88c5 mysql \u8f6f\u4ef6\u5305\u5230\u914d\u7f6e\u670d\u52a1\u5668\u548c\u6570\u636e\u5e93\u5b9e\u4f8b\u7684\u5404\u4e2a\u6b65\u9aa4\u3002\u901a\u8fc7\u9075\u5faa\u672c\u6559\u7a0b\u4e2d\u7684\u8bf4\u660e\uff0c\u8bfb\u8005\u5c06\u80fd\u591f\u5728 linux \u7cfb\u7edf\u4e2d\u6210\u529f\u8bbe\u7f6e\u5e76\u4f7f\u7528 mysql \u6570\u636e\u5e93\u3002 Linux MySQL \u5b89\u88c5\u4e0e\u914d\u7f6e\u6559\u7a0b 1. \u68c0\u67e5 \u786e\u8ba4\u7cfb\u7edf\u7248\u672c\u662f\u5426\u6ee1\u8db3 MySQL \u7684\u6700\u4f4e\u8981\u6c42\u3002\u5bf9\u4e8e\u5927\u591a\u6570\u7248\u672c\uff0c\u63a8\u8350\u4f7f\u7528 Ubuntu \u6216 CentOS\u3002 2. \u5bfc\u5165 MySQL \u5b58\u50a8\u5e93 Ubuntu sudo&nbsp;apt-get&nbsp;install&nbsp;software-properties-common sudo&nbsp;add-apt-repository&nbsp;&#8216;deb&nbsp;[arch=amd64]&nbsp;http:\/\/dev.mysql.com\/get\/mysql-apt\/&nbsp;stable&nbsp;mysql-apt-config&#8217; sudo&nbsp;apt-get&nbsp;update \u767b\u5f55\u540e\u590d\u5236 CentOS wget&nbsp;http:\/\/repo.mysql.com\/mysql-community-release-el7-5.noarch.rpm sudo&nbsp;yum&nbsp;localinstall&nbsp;mysql-community-release-el7-5.noarch.rpm sudo&nbsp;yum&nbsp;update \u767b\u5f55\u540e\u590d\u5236 3. \u5b89\u88c5 MySQL Ubuntu sudo&nbsp;apt-get&nbsp;install&nbsp;mysql-server \u767b\u5f55\u540e\u590d\u5236 CentOS sudo&nbsp;yum&nbsp;install&nbsp;mysql-community-server \u767b\u5f55\u540e\u590d\u5236 4. \u542f\u52a8 MySQL \u670d\u52a1 Ubuntu sudo&nbsp;systemctl&nbsp;start&nbsp;mysql [&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-6677","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6677","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=6677"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6677\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}