{"id":18117,"date":"2024-11-18T17:05:52","date_gmt":"2024-11-18T09:05:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18117\/"},"modified":"2024-11-18T17:05:52","modified_gmt":"2024-11-18T09:05:52","slug":"linux%e6%80%8e%e4%b9%88%e5%88%9b%e5%bb%ba%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18117\/","title":{"rendered":"linux\u600e\u4e48\u521b\u5efa\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u8981\u5728 linux \u4e0a\u521b\u5efa\u6570\u636e\u5e93\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5b89\u88c5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08\u5982 mysql \u6216 mariadb\uff09\u3002\u542f\u52a8\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\u4ee5 root \u7528\u6237\u8eab\u4efd\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\u521b\u5efa\u6570\u636e\u5e93\u5e76\u6388\u4e88\u7528\u6237\u8bbf\u95ee\u6743\u9650\u3002\u5237\u65b0\u6743\u9650\u4f7f\u66f4\u6539\u751f\u6548\u3002\u9000\u51fa\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/03\/2024060312421644008.jpg\" class=\"aligncenter\" title=\"linux\u600e\u4e48\u521b\u5efa\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"linux\u600e\u4e48\u521b\u5efa\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Linux \u4e0a\u521b\u5efa\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u5728 Linux \u7cfb\u7edf\u4e2d\u521b\u5efa\u6570\u636e\u5e93\u6d89\u53ca\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u5b89\u88c5\u6570\u636e\u5e93\u670d\u52a1\u5668<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 MySQL \u6216 MariaDB \u7b49\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a<\/p>\n<pre>$ sudo apt-get install mysql-server<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u542f\u52a8\u6570\u636e\u5e93\u670d\u52a1\u5668<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a<\/p>\n<pre>$ sudo service mysql start<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u521b\u5efa\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4ee5 root \u7528\u6237\u8eab\u4efd\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a<\/p>\n<pre>$ mysql -u root -p<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u5165\u5bc6\u7801\uff0c\u7136\u540e\u521b\u5efa\u6570\u636e\u5e93\uff1a<\/p>\n<pre>mysql&gt; CREATE DATABASE my_database;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u6388\u4e88\u6743\u9650<\/strong><\/p>\n<p>\u6388\u4e88\u7528\u6237\u5bf9\u65b0\u521b\u5efa\u6570\u636e\u5e93\u7684\u8bbf\u95ee\u6743\u9650\uff1a<\/p>\n<pre>mysql&gt; GRANT ALL PRIVILEGES ON my_database.* TO 'username'@'localhost' IDENTIFIED BY 'password';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u66ff\u6362 &#8220;username&#8221; \u548c &#8220;password&#8221; \u4e3a\u5b9e\u9645\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n<p><strong>5. \u5237\u65b0\u6743\u9650<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u6743\u9650\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre>mysql&gt; FLUSH PRIVILEGES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u9000\u51fa\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u9000\u51fa\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a<\/p>\n<pre>mysql&gt; EXIT;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f60\u5df2\u7ecf\u6210\u529f\u5728 Linux \u7cfb\u7edf\u4e0a\u521b\u5efa\u4e86\u4e00\u4e2a\u6570\u636e\u5e93\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u521b\u5efa\u6570\u636e\u5e93\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u5728 linux \u4e0a\u521b\u5efa\u6570\u636e\u5e93\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5b89\u88c5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08\u5982 mysql \u6216 mariadb\uff09\u3002\u542f\u52a8\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\u4ee5 root \u7528\u6237\u8eab\u4efd\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\u521b\u5efa\u6570\u636e\u5e93\u5e76\u6388\u4e88\u7528\u6237\u8bbf\u95ee\u6743\u9650\u3002\u5237\u65b0\u6743\u9650\u4f7f\u66f4\u6539\u751f\u6548\u3002\u9000\u51fa\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002 \u5982\u4f55\u5728 Linux \u4e0a\u521b\u5efa\u6570\u636e\u5e93 \u5728 Linux \u7cfb\u7edf\u4e2d\u521b\u5efa\u6570\u636e\u5e93\u6d89\u53ca\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u5b89\u88c5\u6570\u636e\u5e93\u670d\u52a1\u5668 \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 MySQL \u6216 MariaDB \u7b49\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a $ sudo apt-get install mysql-server \u767b\u5f55\u540e\u590d\u5236 2. \u542f\u52a8\u6570\u636e\u5e93\u670d\u52a1\u5668 \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a $ sudo service mysql start \u767b\u5f55\u540e\u590d\u5236 3. \u521b\u5efa\u6570\u636e\u5e93 \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4ee5 root \u7528\u6237\u8eab\u4efd\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a $ mysql -u root -p \u767b\u5f55\u540e\u590d\u5236 \u8f93\u5165\u5bc6\u7801\uff0c\u7136\u540e\u521b\u5efa\u6570\u636e\u5e93\uff1a mysql&gt; CREATE DATABASE my_database; \u767b\u5f55\u540e\u590d\u5236 4. \u6388\u4e88\u6743\u9650 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-18117","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18117","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=18117"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18117\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}