{"id":6671,"date":"2024-11-14T14:49:41","date_gmt":"2024-11-14T06:49:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6671\/"},"modified":"2024-11-14T14:49:41","modified_gmt":"2024-11-14T06:49:41","slug":"%e8%b6%85%e8%af%a6%e7%bb%86mysql%e5%ae%89%e8%a3%85%e5%8f%8a%e5%9f%ba%e6%9c%ac%e4%bd%bf%e7%94%a8%e6%95%99%e7%a8%8b%ef%bc%88%e6%96%b0%e6%89%8b%e5%b0%8f%e7%99%bd%e5%bf%85%e7%9c%8b%ef%bc%89","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6671\/","title":{"rendered":"\u8d85\u8be6\u7ec6MySQL\u5b89\u88c5\u53ca\u57fa\u672c\u4f7f\u7528\u6559\u7a0b\uff08\u65b0\u624b\u5c0f\u767d\u5fc5\u770b\uff09"},"content":{"rendered":"<blockquote><p>\n  \u8fd9\u7bc7\u6559\u7a0b\u8be6\u7ec6\u5730\u4ecb\u7ecd\u4e86 mysql \u6570\u636e\u5e93\u7684\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528\uff0c\u4e13\u4e3a\u6570\u636e\u5e93\u65b0\u624b\u5c0f\u767d\u800c\u5199\u3002\u6559\u7a0b\u4ece\u5934\u5f00\u59cb\uff0c\u6307\u5bfc\u8bfb\u8005\u9010\u6b65\u5b8c\u6210 mysql \u7684\u5b89\u88c5\uff0c\u5e76\u6db5\u76d6\u57fa\u672c\u64cd\u4f5c\uff0c\u5982\u6570\u636e\u5e93\u521b\u5efa\u3001\u8868\u7ba1\u7406\u3001\u6570\u636e\u64cd\u4f5c\u548c\u67e5\u8be2\u3002\u65e0\u8bba\u4f60\u662f\u6570\u636e\u5e93\u521d\u5b66\u8005\u8fd8\u662f\u60f3\u4e86\u89e3 mysql \u57fa\u7840\u77e5\u8bc6\u7684\u4eba\uff0c\u8fd9\u7bc7\u6559\u7a0b\u90fd\u4f1a\u63d0\u4f9b\u5b9d\u8d35\u7684\u89c1\u89e3\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202410\/17\/2024101714124624275.jpg\" class=\"aligncenter\" title=\"\u8d85\u8be6\u7ec6MySQL\u5b89\u88c5\u53ca\u57fa\u672c\u4f7f\u7528\u6559\u7a0b\uff08\u65b0\u624b\u5c0f\u767d\u5fc5\u770b\uff09\u63d2\u56fe\" alt=\"\u8d85\u8be6\u7ec6MySQL\u5b89\u88c5\u53ca\u57fa\u672c\u4f7f\u7528\u6559\u7a0b\uff08\u65b0\u624b\u5c0f\u767d\u5fc5\u770b\uff09\u63d2\u56fe\" \/><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u8d85\u8be6\u7ec6 MySQL \u5b89\u88c5\u53ca\u57fa\u672c\u4f7f\u7528\u6559\u7a0b<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u4e00\u3001\u5b89\u88c5 MySQL<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>1. \u4e0b\u8f7d MySQL \u5b89\u88c5\u5305<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u8bbf\u95ee [MySQL \u5b98\u7f51](https:\/\/www..com\/downloads\/) \u4e0b\u8f7d\u9002\u7528\u4e8e\u60a8\u548c\u8ba1\u7b97\u673a\u67b6\u6784\u7684 MySQL \u5b89\u88c5\u5305\u3002<\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>2. \u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u6253\u5f00\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002\u9009\u62e9\u5178\u578b\u5b89\u88c5\u5373\u53ef\u3002<\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>3. \u914d\u7f6e MySQL<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u914d\u7f6e MySQL \u7684\u4e00\u4e9b\u57fa\u672c\u8bbe\u7f6e\uff1a<\/p>\n<ul>\n<li>\u8bbe\u7f6e root \u7528\u6237\u5bc6\u7801\uff1a\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u6216\u5b89\u88c5\u5b8c\u6210\u540e\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e root \u7528\u6237\u5bc6\u7801\uff1a<\/li>\n<\/ul>\n<pre>mysqladmin&nbsp;-u&nbsp;root&nbsp;password&nbsp;\"\u65b0\u5bc6\u7801\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u542f\u7528\u8fdc\u7a0b\u8fde\u63a5\uff1a\u7f16\u8f91&nbsp;my.ini&nbsp;\u6216&nbsp;my.cnf&nbsp;\u914d\u7f6e\u6587\u4ef6\uff08Windows \u5728&nbsp;C:ProgramDataMySQLMySQL Server 8.0my.ini\uff0cLinux \u5728&nbsp;\/etc\/mysql\/my.cnf\uff09\uff0c\u53d6\u6d88\u6ce8\u91ca\u6216\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/li>\n<\/ul>\n<pre>bind-address&nbsp;=&nbsp;0.0.0.0<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u91cd\u542f MySQL \u670d\u52a1\uff1aWindows \u670d\u52a1\uff0c\u6216\u4f7f\u7528\u4ee5\u4e0b Linux \u547d\u4ee4\u91cd\u542f\uff1a<\/li>\n<\/ul>\n<pre>sudo&nbsp;systemctl&nbsp;restart&nbsp;mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>\u4e8c\u3001\u57fa\u672c\u4f7f\u7528<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>1. \u767b\u5f55 MySQL<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\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:\">\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u540e\uff0c\u5373\u53ef\u767b\u5f55 MySQL\u3002<\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>2. \u521b\u5efa\u6570\u636e\u5e93<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;CREATE DATABASE&nbsp;\u8bed\u53e5\u521b\u5efa\u6570\u636e\u5e93\uff1a<\/p>\n<pre>CREATE&nbsp;DATABASE&nbsp;mydatabase;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>3. \u9009\u62e9\u6570\u636e\u5e93<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;USE&nbsp;\u8bed\u53e5\u9009\u62e9\u8981\u64cd\u4f5c\u7684\u6570\u636e\u5e93\uff1a<\/p>\n<pre>USE&nbsp;mydatabase;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>4. \u521b\u5efa\u8868<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;CREATE TABLE&nbsp;\u8bed\u53e5\u521b\u5efa\u8868\uff1a<\/p>\n<pre>CREATE&nbsp;TABLE&nbsp;mytable&nbsp;(\n&nbsp;&nbsp;id&nbsp;INT&nbsp;NOT&nbsp;NULL&nbsp;AUTO_INCREMENT,\n&nbsp;&nbsp;name&nbsp;VARCHAR(255)&nbsp;NOT&nbsp;NULL,\n&nbsp;&nbsp;age&nbsp;INT&nbsp;NOT&nbsp;NULL,\n&nbsp;&nbsp;PRIMARY&nbsp;KEY&nbsp;(id)\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>5. \u63d2\u5165\u6570\u636e<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;INSERT INTO&nbsp;\u8bed\u53e5\u63d2\u5165\u6570\u636e\uff1a<\/p>\n<pre>INSERT&nbsp;INTO&nbsp;mytable&nbsp;(name,&nbsp;age)&nbsp;VALUES&nbsp;('John&nbsp;Doe',&nbsp;30);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>6. \u67e5\u8be2\u6570\u636e<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;SELECT&nbsp;\u8bed\u53e5\u67e5\u8be2\u6570\u636e\uff1a<\/p>\n<pre>SELECT&nbsp;*&nbsp;FROM&nbsp;mytable;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>7. \u66f4\u65b0\u6570\u636e<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;UPDATE&nbsp;\u8bed\u53e5\u66f4\u65b0\u6570\u636e\uff1a<\/p>\n<pre>UPDATE&nbsp;mytable&nbsp;SET&nbsp;name&nbsp;=&nbsp;'John&nbsp;Smith'&nbsp;WHERE&nbsp;id&nbsp;=&nbsp;1;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>8. \u5220\u9664\u6570\u636e<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;DELETE&nbsp;\u8bed\u53e5\u5220\u9664\u6570\u636e\uff1a<\/p>\n<pre>DELETE&nbsp;FROM&nbsp;mytable&nbsp;WHERE&nbsp;id&nbsp;=&nbsp;1;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\"><strong>9. \u9000\u51fa MySQL<\/strong><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 9px;font-family:\">\u4f7f\u7528&nbsp;EXIT&nbsp;\u6216&nbsp;QUIT&nbsp;\u547d\u4ee4\u9000\u51fa MySQL\uff1a<\/p>\n<pre>EXIT;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u8d85\u8be6\u7ec6MySQL\u5b89\u88c5\u53ca\u57fa\u672c\u4f7f\u7528\u6559\u7a0b\uff08\u65b0\u624b\u5c0f\u767d\u5fc5\u770b\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>\u8fd9\u7bc7\u6559\u7a0b\u8be6\u7ec6\u5730\u4ecb\u7ecd\u4e86 mysql \u6570\u636e\u5e93\u7684\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528\uff0c\u4e13\u4e3a\u6570\u636e\u5e93\u65b0\u624b\u5c0f\u767d\u800c\u5199\u3002\u6559\u7a0b\u4ece\u5934\u5f00\u59cb\uff0c\u6307\u5bfc\u8bfb\u8005\u9010\u6b65\u5b8c\u6210 mysql \u7684\u5b89\u88c5\uff0c\u5e76\u6db5\u76d6\u57fa\u672c\u64cd\u4f5c\uff0c\u5982\u6570\u636e\u5e93\u521b\u5efa\u3001\u8868\u7ba1\u7406\u3001\u6570\u636e\u64cd\u4f5c\u548c\u67e5\u8be2\u3002\u65e0\u8bba\u4f60\u662f\u6570\u636e\u5e93\u521d\u5b66\u8005\u8fd8\u662f\u60f3\u4e86\u89e3 mysql \u57fa\u7840\u77e5\u8bc6\u7684\u4eba\uff0c\u8fd9\u7bc7\u6559\u7a0b\u90fd\u4f1a\u63d0\u4f9b\u5b9d\u8d35\u7684\u89c1\u89e3\u3002 \u8d85\u8be6\u7ec6 MySQL \u5b89\u88c5\u53ca\u57fa\u672c\u4f7f\u7528\u6559\u7a0b \u4e00\u3001\u5b89\u88c5 MySQL 1. \u4e0b\u8f7d MySQL \u5b89\u88c5\u5305 \u8bbf\u95ee [MySQL \u5b98\u7f51](https:\/\/www..com\/downloads\/) \u4e0b\u8f7d\u9002\u7528\u4e8e\u60a8\u548c\u8ba1\u7b97\u673a\u67b6\u6784\u7684 MySQL \u5b89\u88c5\u5305\u3002 2. \u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f \u6253\u5f00\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002\u9009\u62e9\u5178\u578b\u5b89\u88c5\u5373\u53ef\u3002 3. \u914d\u7f6e MySQL \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u914d\u7f6e MySQL \u7684\u4e00\u4e9b\u57fa\u672c\u8bbe\u7f6e\uff1a \u8bbe\u7f6e root \u7528\u6237\u5bc6\u7801\uff1a\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u6216\u5b89\u88c5\u5b8c\u6210\u540e\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e root \u7528\u6237\u5bc6\u7801\uff1a mysqladmin&nbsp;-u&nbsp;root&nbsp;password&nbsp;&#8220;\u65b0\u5bc6\u7801&#8221; \u767b\u5f55\u540e\u590d\u5236 \u542f\u7528\u8fdc\u7a0b\u8fde\u63a5\uff1a\u7f16\u8f91&nbsp;my.ini&nbsp;\u6216&nbsp;my.cnf&nbsp;\u914d\u7f6e\u6587\u4ef6\uff08Windows \u5728&nbsp;C:ProgramDataMySQLMySQL Server 8.0my.ini\uff0cLinux \u5728&nbsp;\/etc\/mysql\/my.cnf\uff09\uff0c\u53d6\u6d88\u6ce8\u91ca\u6216\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a bind-address&nbsp;=&nbsp;0.0.0.0 \u767b\u5f55\u540e\u590d\u5236 \u91cd\u542f MySQL \u670d\u52a1\uff1aWindows \u670d\u52a1\uff0c\u6216\u4f7f\u7528\u4ee5\u4e0b Linux \u547d\u4ee4\u91cd\u542f\uff1a sudo&nbsp;systemctl&nbsp;restart&nbsp;mysql \u767b\u5f55\u540e\u590d\u5236 \u4e8c\u3001\u57fa\u672c\u4f7f\u7528 1. [&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-6671","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6671","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=6671"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6671\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}