{"id":195443,"date":"2024-11-13T15:02:37","date_gmt":"2024-11-13T07:02:37","guid":{"rendered":"https:\/\/server.hk\/cnblog\/195443\/"},"modified":"2024-11-13T15:02:38","modified_gmt":"2024-11-13T07:02:38","slug":"%e8%88%87mysql%e6%95%b8%e6%93%9a%e5%ba%ab%e6%8a%80%e8%a1%93%e8%a6%aa%e5%af%86%e6%8e%a5%e8%a7%b8","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/195443\/","title":{"rendered":"\u8207MySQL\u6578\u64da\u5eab\u6280\u8853\u89aa\u5bc6\u63a5\u89f8"},"content":{"rendered":"<h1 id=\"%e8%88%87mysql%e6%95%b8%e6%93%9a%e5%ba%ab%e6%8a%80%e8%a1%93%e8%a6%aa%e5%af%86%e6%8e%a5%e8%a7%b8-ypbQajzfzU\">\u8207MySQL\u6578\u64da\u5eab\u6280\u8853\u89aa\u5bc6\u63a5\u89f8<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u9a45\u52d5\u6642\u4ee3\uff0c\u6578\u64da\u5eab\u6280\u8853\u7684\u9078\u64c7\u5c0d\u65bc\u4f01\u696d\u7684\u6210\u529f\u81f3\u95dc\u91cd\u8981\u3002MySQL\u4f5c\u70ba\u4e00\u7a2e\u958b\u6e90\u7684\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u56e0\u5176\u9ad8\u6548\u6027\u3001\u53ef\u9760\u6027\u548c\u9748\u6d3b\u6027\u800c\u53d7\u5230\u5ee3\u6cdb\u4f7f\u7528\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eMySQL\u7684\u57fa\u672c\u6982\u5ff5\u3001\u7279\u6027\u3001\u4f7f\u7528\u5834\u666f\u4ee5\u53ca\u4e00\u4e9b\u5be6\u7528\u7684\u64cd\u4f5c\u6280\u5de7\u3002<\/p>\n<h2 id=\"mysql%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5-ypbQajzfzU\">MySQL\u7684\u57fa\u672c\u6982\u5ff5<\/h2>\n<p>MySQL\u662f\u4e00\u7a2e\u57fa\u65bcSQL\uff08\u7d50\u69cb\u5316\u67e5\u8a62\u8a9e\u8a00\uff09\u7684\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u6700\u521d\u7531\u745e\u5178\u7684MySQL AB\u516c\u53f8\u958b\u767c\uff0c\u5f8c\u4f86\u88abOracle\u516c\u53f8\u6536\u8cfc\u3002MySQL\u652f\u6301\u591a\u7a2e\u64cd\u4f5c\u7cfb\u7d71\uff0c\u5305\u62ecWindows\u3001Linux\u548cmacOS\uff0c\u4e26\u4e14\u53ef\u4ee5\u8207\u591a\u7a2e\u7de8\u7a0b\u8a9e\u8a00\uff08\u5982PHP\u3001Python\u3001Java\u7b49\uff09\u7121\u7e2b\u96c6\u6210\u3002<\/p>\n<h2 id=\"mysql%e7%9a%84%e7%89%b9%e6%80%a7-ypbQajzfzU\">MySQL\u7684\u7279\u6027<\/h2>\n<ul>\n<li><strong>\u958b\u6e90\u6027\uff1a<\/strong>MySQL\u662f\u958b\u6e90\u7684\uff0c\u9019\u610f\u5473\u8457\u7528\u6236\u53ef\u4ee5\u81ea\u7531\u4f7f\u7528\u3001\u4fee\u6539\u548c\u5206\u767c\u5176\u6e90\u4ee3\u78bc\u3002<\/li>\n<li><strong>\u9ad8\u6027\u80fd\uff1a<\/strong>MySQL\u5728\u8655\u7406\u5927\u91cf\u6578\u64da\u6642\u8868\u73fe\u51fa\u8272\uff0c\u7279\u5225\u662f\u5728\u8b80\u53d6\u64cd\u4f5c\u4e0a\u3002<\/li>\n<li><strong>\u53ef\u9760\u6027\uff1a<\/strong>MySQL\u63d0\u4f9b\u4e86\u591a\u7a2e\u6578\u64da\u4fdd\u8b77\u6a5f\u5236\uff0c\u5982\u4e8b\u52d9\u652f\u6301\u548c\u6578\u64da\u5099\u4efd\u529f\u80fd\u3002<\/li>\n<li><strong>\u9748\u6d3b\u6027\uff1a<\/strong>MySQL\u652f\u6301\u591a\u7a2e\u5b58\u5132\u5f15\u64ce\uff0c\u4f7f\u7528\u8005\u53ef\u4ee5\u6839\u64da\u9700\u6c42\u9078\u64c7\u6700\u5408\u9069\u7684\u5f15\u64ce\u3002<\/li>\n<li><strong>\u5b89\u5168\u6027\uff1a<\/strong>MySQL\u63d0\u4f9b\u4e86\u591a\u5c64\u6b21\u7684\u5b89\u5168\u6a5f\u5236\uff0c\u5305\u62ec\u7528\u6236\u6b0a\u9650\u7ba1\u7406\u548c\u6578\u64da\u52a0\u5bc6\u3002<\/li>\n<\/ul>\n<h2 id=\"mysql%e7%9a%84%e4%bd%bf%e7%94%a8%e5%a0%b4%e6%99%af-ypbQajzfzU\">MySQL\u7684\u4f7f\u7528\u5834\u666f<\/h2>\n<p>MySQL\u88ab\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u5834\u666f\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u65bc\uff1a<\/p>\n<ul>\n<li><strong>\u7db2\u7ad9\u5f8c\u7aef\uff1a<\/strong>\u8a31\u591a\u7db2\u7ad9\u4f7f\u7528MySQL\u4f5c\u70ba\u5176\u5f8c\u7aef\u6578\u64da\u5eab\uff0c\u5b58\u5132\u7528\u6236\u4fe1\u606f\u3001\u6587\u7ae0\u5167\u5bb9\u7b49\u3002<\/li>\n<li><strong>\u96fb\u5b50\u5546\u52d9\u5e73\u53f0\uff1a<\/strong>MySQL\u80fd\u5920\u9ad8\u6548\u8655\u7406\u8a02\u55ae\u3001\u5eab\u5b58\u548c\u7528\u6236\u6578\u64da\uff0c\u9069\u5408\u96fb\u5b50\u5546\u52d9\u61c9\u7528\u3002<\/li>\n<li><strong>\u6578\u64da\u5206\u6790\uff1a<\/strong>MySQL\u53ef\u4ee5\u7528\u65bc\u5b58\u5132\u548c\u5206\u6790\u5927\u91cf\u6578\u64da\uff0c\u5e6b\u52a9\u4f01\u696d\u505a\u51fa\u6578\u64da\u9a45\u52d5\u7684\u6c7a\u7b56\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c%e6%8a%80%e5%b7%a7-ypbQajzfzU\">\u57fa\u672c\u64cd\u4f5c\u6280\u5de7<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684MySQL\u64cd\u4f5c\u6280\u5de7\uff0c\u5e6b\u52a9\u7528\u6236\u66f4\u6709\u6548\u5730\u4f7f\u7528\u9019\u4e00\u6578\u64da\u5eab\u7cfb\u7d71\uff1a<\/p>\n<h3 id=\"1-%e5%89%b5%e5%bb%ba%e6%95%b8%e6%93%9a%e5%ba%ab%e5%92%8c%e8%a1%a8-ypbQajzfzU\">1. \u5275\u5efa\u6578\u64da\u5eab\u548c\u8868<\/h3>\n<pre><code>CREATE DATABASE my_database;\nUSE my_database;\n\nCREATE TABLE users (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    username VARCHAR(50) NOT NULL,\n    password VARCHAR(255) NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);<\/code><\/pre>\n<h3 id=\"2-%e6%8f%92%e5%85%a5%e6%95%b8%e6%93%9a-ypbQajzfzU\">2. \u63d2\u5165\u6578\u64da<\/h3>\n<pre><code>INSERT INTO users (username, password) VALUES ('user1', 'password1');<\/code><\/pre>\n<h3 id=\"3-%e6%9f%a5%e8%a9%a2%e6%95%b8%e6%93%9a-ypbQajzfzU\">3. \u67e5\u8a62\u6578\u64da<\/h3>\n<pre><code>SELECT * FROM users WHERE username = 'user1';<\/code><\/pre>\n<h3 id=\"4-%e6%9b%b4%e6%96%b0%e6%95%b8%e6%93%9a-ypbQajzfzU\">4. \u66f4\u65b0\u6578\u64da<\/h3>\n<pre><code>UPDATE users SET password = 'new_password' WHERE username = 'user1';<\/code><\/pre>\n<h3 id=\"5-%e5%88%aa%e9%99%a4%e6%95%b8%e6%93%9a-ypbQajzfzU\">5. \u522a\u9664\u6578\u64da<\/h3>\n<pre><code>DELETE FROM users WHERE username = 'user1';<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-ypbQajzfzU\">\u7e3d\u7d50<\/h2>\n<p>MySQL\u4f5c\u70ba\u4e00\u7a2e\u5f37\u5927\u7684\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u56e0\u5176\u958b\u6e90\u6027\u3001\u9ad8\u6027\u80fd\u548c\u9748\u6d3b\u6027\u800c\u53d7\u5230\u5ee3\u6cdb\u9752\u775e\u3002\u7121\u8ad6\u662f\u5728\u7db2\u7ad9\u958b\u767c\u3001\u96fb\u5b50\u5546\u52d9\u9084\u662f\u6578\u64da\u5206\u6790\u4e2d\uff0cMySQL\u90fd\u80fd\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002\u5c0d\u65bc\u5e0c\u671b\u5728\u9999\u6e2f\u5c0b\u627e\u53ef\u9760\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\u7684\u4f01\u696d\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u6216 <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u4f86\u904b\u884cMySQL\u5c07\u662f\u660e\u667a\u4e4b\u8209\u3002\u900f\u904e\u9019\u4e9b\u6280\u8853\uff0c\u4f01\u696d\u80fd\u5920\u66f4\u597d\u5730\u7ba1\u7406\u548c\u5206\u6790\u6578\u64da\uff0c\u5f9e\u800c\u63d0\u5347\u696d\u52d9\u6548\u7387\u548c\u7af6\u722d\u529b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6df1\u5165\u63a2\u7d22MySQL\u6578\u64da\u5eab\u6280\u8853\uff0c\u638c\u63e1\u6578\u64da\u7ba1\u7406\u3001\u67e5\u8a62\u512a\u5316\u53ca\u6027\u80fd\u63d0\u5347\u7684\u95dc\u9375\u6280\u5de7\uff0c\u52a9\u60a8\u63d0\u5347\u958b\u767c\u6548\u7387\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-195443","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/195443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=195443"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/195443\/revisions"}],"predecessor-version":[{"id":195444,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/195443\/revisions\/195444"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=195443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=195443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=195443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}