{"id":76286,"date":"2024-10-16T05:24:14","date_gmt":"2024-10-15T21:24:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/76286\/"},"modified":"2024-10-16T05:24:14","modified_gmt":"2024-10-15T21:24:14","slug":"mysql%e5%85%a5%e9%96%80%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/76286\/","title":{"rendered":"MySQL\u5165\u9580\u6307\u5357"},"content":{"rendered":"<h1 id=\"mysql%e5%85%a5%e9%96%80%e6%8c%87%e5%8d%97-vFweWZuCfm\">MySQL\u5165\u9580\u6307\u5357<\/h1>\n<p>MySQL\u662f\u4e00\u7a2e\u6d41\u884c\u7684\u958b\u6e90\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5e8f\u4e2d\u3002\u7121\u8ad6\u662f\u5c0f\u578b\u500b\u4eba\u9805\u76ee\u9084\u662f\u5927\u578b\u4f01\u696d\u61c9\u7528\uff0cMySQL\u90fd\u80fd\u63d0\u4f9b\u7a69\u5b9a\u548c\u9ad8\u6548\u7684\u6578\u64da\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\u3002\u672c\u6307\u5357\u5c07\u4ecb\u7d39MySQL\u7684\u57fa\u672c\u6982\u5ff5\u3001\u5b89\u88dd\u6b65\u9a5f\u3001\u57fa\u672c\u64cd\u4f5c\u4ee5\u53ca\u4e00\u4e9b\u6700\u4f73\u5be6\u8e10\uff0c\u5e6b\u52a9\u521d\u5b78\u8005\u5feb\u901f\u4e0a\u624b\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afmysql%ef%bc%9f-vFweWZuCfm\">\u4ec0\u9ebc\u662fMySQL\uff1f<\/h2>\n<p>MySQL\u662f\u4e00\u500b\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\u516c\u53f8MySQL AB\u958b\u767c\uff0c\u5f8c\u4f86\u88abOracle\u6536\u8cfc\u3002MySQL\u7684\u7279\u9ede\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u958b\u6e90\uff1aMySQL\u662f\u514d\u8cbb\u7684\uff0c\u4e26\u4e14\u6709\u5ee3\u6cdb\u7684\u793e\u5340\u652f\u6301\u3002<\/li>\n<li>\u9ad8\u6548\uff1a\u80fd\u5920\u8655\u7406\u5927\u91cf\u6578\u64da\u4e26\u652f\u6301\u9ad8\u4e26\u767c\u8a2a\u554f\u3002<\/li>\n<li>\u9748\u6d3b\uff1a\u652f\u6301\u591a\u7a2e\u64cd\u4f5c\u7cfb\u7d71\uff0c\u5305\u62ecWindows\u3001Linux\u548cmacOS\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%ae%89%e8%a3%9dmysql-vFweWZuCfm\">\u5b89\u88ddMySQL<\/h2>\n<p>\u5728\u958b\u59cb\u4f7f\u7528MySQL\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u5b89\u88dd\u5b83\u3002\u4ee5\u4e0b\u662f\u5b89\u88ddMySQL\u7684\u57fa\u672c\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"%e5%9c%a8windows%e4%b8%8a%e5%ae%89%e8%a3%9dmysql-vFweWZuCfm\">\u5728Windows\u4e0a\u5b89\u88ddMySQL<\/h3>\n<ol>\n<li>\u8a2a\u554fMySQL\u5b98\u65b9\u7db2\u7ad9\uff0c\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u7684MySQL\u5b89\u88dd\u5305\u3002<\/li>\n<li>\u904b\u884c\u5b89\u88dd\u7a0b\u5e8f\uff0c\u9078\u64c7\u201c\u81ea\u5b9a\u7fa9\u5b89\u88dd\u201d\u4ee5\u9078\u64c7\u6240\u9700\u7684\u7d44\u4ef6\u3002<\/li>\n<li>\u8a2d\u7f6eroot\u7528\u6236\u7684\u5bc6\u78bc\uff0c\u4e26\u9078\u64c7\u555f\u52d5MySQL\u670d\u52d9\u3002<\/li>\n<li>\u5b8c\u6210\u5b89\u88dd\u5f8c\uff0c\u4f7f\u7528\u547d\u4ee4\u884c\u6216MySQL Workbench\u9023\u63a5\u5230\u6578\u64da\u5eab\u3002<\/li>\n<\/ol>\n<h3 id=\"%e5%9c%a8linux%e4%b8%8a%e5%ae%89%e8%a3%9dmysql-vFweWZuCfm\">\u5728Linux\u4e0a\u5b89\u88ddMySQL<\/h3>\n<pre><code>sudo apt update\nsudo apt install mysql-server\n<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5MySQL\u670d\u52d9\uff1a<\/p>\n<pre><code>sudo systemctl start mysql\n<\/code><\/pre>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c-vFweWZuCfm\">\u57fa\u672c\u64cd\u4f5c<\/h2>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u958b\u59cb\u4f7f\u7528MySQL\u9032\u884c\u6578\u64da\u5eab\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u64cd\u4f5c\u793a\u4f8b\uff1a<\/p>\n<h3 id=\"%e5%89%b5%e5%bb%ba%e6%95%b8%e6%93%9a%e5%ba%ab-vFweWZuCfm\">\u5275\u5efa\u6578\u64da\u5eab<\/h3>\n<pre><code>CREATE DATABASE my_database;\n<\/code><\/pre>\n<h3 id=\"%e4%bd%bf%e7%94%a8%e6%95%b8%e6%93%9a%e5%ba%ab-vFweWZuCfm\">\u4f7f\u7528\u6578\u64da\u5eab<\/h3>\n<pre><code>USE my_database;\n<\/code><\/pre>\n<h3 id=\"%e5%89%b5%e5%bb%ba%e8%a1%a8-vFweWZuCfm\">\u5275\u5efa\u8868<\/h3>\n<pre><code>CREATE TABLE users (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    username VARCHAR(50) NOT NULL,\n    password VARCHAR(50) NOT NULL\n);\n<\/code><\/pre>\n<h3 id=\"%e6%8f%92%e5%85%a5%e6%95%b8%e6%93%9a-vFweWZuCfm\">\u63d2\u5165\u6578\u64da<\/h3>\n<pre><code>INSERT INTO users (username, password) VALUES ('user1', 'password1');\n<\/code><\/pre>\n<h3 id=\"%e6%9f%a5%e8%a9%a2%e6%95%b8%e6%93%9a-vFweWZuCfm\">\u67e5\u8a62\u6578\u64da<\/h3>\n<pre><code>SELECT * FROM users;\n<\/code><\/pre>\n<h2 id=\"%e6%9c%80%e4%bd%b3%e5%af%a6%e8%b8%90-vFweWZuCfm\">\u6700\u4f73\u5be6\u8e10<\/h2>\n<p>\u5728\u4f7f\u7528MySQL\u6642\uff0c\u9075\u5faa\u4e00\u4e9b\u6700\u4f73\u5be6\u8e10\u53ef\u4ee5\u63d0\u9ad8\u6578\u64da\u5eab\u7684\u6027\u80fd\u548c\u5b89\u5168\u6027\uff1a<\/p>\n<ul>\n<li>\u5b9a\u671f\u5099\u4efd\u6578\u64da\u5eab\uff0c\u4ee5\u9632\u6578\u64da\u4e1f\u5931\u3002<\/li>\n<li>\u4f7f\u7528\u9069\u7576\u7684\u6578\u64da\u985e\u578b\uff0c\u4ee5\u7bc0\u7701\u5b58\u5132\u7a7a\u9593\u3002<\/li>\n<li>\u70ba\u8868\u4e2d\u7684\u5217\u5275\u5efa\u7d22\u5f15\uff0c\u4ee5\u63d0\u9ad8\u67e5\u8a62\u6027\u80fd\u3002<\/li>\n<li>\u5b9a\u671f\u6aa2\u67e5\u548c\u512a\u5316\u6578\u64da\u5eab\uff0c\u4ee5\u4fdd\u6301\u5176\u9ad8\u6548\u904b\u884c\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-vFweWZuCfm\">\u7e3d\u7d50<\/h2>\n<p>MySQL\u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u4e14\u9748\u6d3b\u7684\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u9069\u5408\u5404\u7a2e\u898f\u6a21\u7684\u61c9\u7528\u3002\u901a\u904e\u672c\u6307\u5357\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u638c\u63e1MySQL\u7684\u57fa\u672c\u6982\u5ff5\u548c\u64cd\u4f5c\uff0c\u4e26\u958b\u59cb\u69cb\u5efa\u81ea\u5df1\u7684\u6578\u64da\u5eab\u61c9\u7528\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684\u6578\u64da\u5eab\u74b0\u5883\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u4f86\u90e8\u7f72\u60a8\u7684MySQL\u670d\u52d9\u3002\u7121\u8ad6\u662f\u500b\u4eba\u9805\u76ee\u9084\u662f\u5546\u696d\u61c9\u7528\uff0c\u9078\u64c7\u5408\u9069\u7684<a href=\"https:\/\/server.hk\">\u4f3a\u670d\u5668<\/a>\u90fd\u80fd\u70ba\u60a8\u7684\u6578\u64da\u5eab\u63d0\u4f9b\u826f\u597d\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u5165\u9580\u6307\u5357\uff1a\u5b78\u7fd2MySQL\u7684\u57fa\u672c\u6982\u5ff5\u3001\u5b89\u88dd\u6b65\u9a5f\u53ca\u5e38\u7528\u67e5\u8a62\uff0c\u52a9\u4f60\u5feb\u901f\u638c\u63e1\u6578\u64da\u5eab\u7ba1\u7406\u6280\u80fd\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-76286","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76286","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=76286"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76286\/revisions"}],"predecessor-version":[{"id":76287,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/76286\/revisions\/76287"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=76286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=76286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=76286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}