{"id":6198,"date":"2024-11-14T11:22:19","date_gmt":"2024-11-14T03:22:19","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6198\/"},"modified":"2024-11-14T11:22:19","modified_gmt":"2024-11-14T03:22:19","slug":"mysql%e5%a6%82%e4%bd%95%e5%88%9b%e5%bb%ba%e6%95%b0%e6%8d%ae%e5%ba%93%e5%88%9b%e5%bb%ba%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6198\/","title":{"rendered":"mysql\u5982\u4f55\u521b\u5efa\u6570\u636e\u5e93\u521b\u5efa\u8868"},"content":{"rendered":"<blockquote><p>\n  \u7b54\u6848\uff1a\u8981\u4f7f\u7528 mysql \u521b\u5efa\u6570\u636e\u5e93\u548c\u8868\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u4e24\u6b65\u64cd\u4f5c\uff1a\u6b65\u9aa4 1\uff1a\u4f7f\u7528 create database \u8bed\u53e5\u521b\u5efa\u6570\u636e\u5e93\u3002\u6b65\u9aa4 2\uff1a\u4f7f\u7528 create table \u8bed\u53e5\u521b\u5efa\u8868\uff0c\u6307\u5b9a\u8981\u5305\u542b\u7684\u5217\u548c\u6570\u636e\u7c7b\u578b\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/14\/2024061406152390219.jpg\" class=\"aligncenter\" title=\"mysql\u5982\u4f55\u521b\u5efa\u6570\u636e\u5e93\u521b\u5efa\u8868\u63d2\u56fe\" alt=\"mysql\u5982\u4f55\u521b\u5efa\u6570\u636e\u5e93\u521b\u5efa\u8868\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 MySQL \u521b\u5efa\u6570\u636e\u5e93\u548c\u8868<\/strong><\/p>\n<p><strong>\u7b2c\u4e00\u6b65\uff1a\u521b\u5efa\u6570\u636e\u5e93<\/strong><\/p>\n<ol>\n<li>\u4f7f\u7528 create database \u8bed\u53e5\uff0c\u540e\u8ddf\u8981\u521b\u5efa\u7684\u6570\u636e\u5e93\u540d\u79f0\uff1a<\/li>\n<\/ol>\n<pre>CREATE DATABASE databasename;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u521b\u5efa\u540d\u4e3a my_database \u7684\u6570\u636e\u5e93\uff0c\u8bf7\u8f93\u5165\uff1a<\/p>\n<pre>CREATE DATABASE my_database;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\u4f7f\u7528 show databases; \u8bed\u53e5\u68c0\u67e5\u6570\u636e\u5e93\u662f\u5426\u5df2\u521b\u5efa\uff1a<\/li>\n<\/ol>\n<p><strong>\u7b2c\u4e8c\u6b65\uff1a\u521b\u5efa\u8868<\/strong><\/p>\n<ol>\n<li>\u4f7f\u7528 create table \u8bed\u53e5\uff0c\u540e\u8ddf\u8981\u521b\u5efa\u7684\u8868\u540d\u548c\u5217\u5b9a\u4e49\uff1a<\/li>\n<\/ol>\n<pre>CREATE TABLE tablename (\n  columnname1 datatype,\n  columnname2 datatype,\n  ...\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u521b\u5efa\u540d\u4e3a customers \u7684\u8868\uff0c\u5176\u4e2d\u5305\u542b id\uff08\u6574\u6570\uff09\u3001name\uff08\u5b57\u7b26\u4e32\uff09\u548c email\uff08\u5b57\u7b26\u4e32\uff09\u5217\uff0c\u8bf7\u8f93\u5165\uff1a<\/p>\n<pre>CREATE TABLE customers (\n  id INT NOT NULL AUTO_INCREMENT,\n  name VARCHAR(255) NOT NULL,\n  email VARCHAR(255) NOT NULL\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\u4f7f\u7528 show tables; \u8bed\u53e5\u68c0\u67e5\u8868\u662f\u5426\u5df2\u521b\u5efa\uff1a<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u521b\u5efa\u6570\u636e\u5e93\u521b\u5efa\u8868\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>\u7b54\u6848\uff1a\u8981\u4f7f\u7528 mysql \u521b\u5efa\u6570\u636e\u5e93\u548c\u8868\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u4e24\u6b65\u64cd\u4f5c\uff1a\u6b65\u9aa4 1\uff1a\u4f7f\u7528 create database \u8bed\u53e5\u521b\u5efa\u6570\u636e\u5e93\u3002\u6b65\u9aa4 2\uff1a\u4f7f\u7528 create table \u8bed\u53e5\u521b\u5efa\u8868\uff0c\u6307\u5b9a\u8981\u5305\u542b\u7684\u5217\u548c\u6570\u636e\u7c7b\u578b\u3002 \u5982\u4f55\u4f7f\u7528 MySQL \u521b\u5efa\u6570\u636e\u5e93\u548c\u8868 \u7b2c\u4e00\u6b65\uff1a\u521b\u5efa\u6570\u636e\u5e93 \u4f7f\u7528 create database \u8bed\u53e5\uff0c\u540e\u8ddf\u8981\u521b\u5efa\u7684\u6570\u636e\u5e93\u540d\u79f0\uff1a CREATE DATABASE databasename; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u521b\u5efa\u540d\u4e3a my_database \u7684\u6570\u636e\u5e93\uff0c\u8bf7\u8f93\u5165\uff1a CREATE DATABASE my_database; \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528 show databases; \u8bed\u53e5\u68c0\u67e5\u6570\u636e\u5e93\u662f\u5426\u5df2\u521b\u5efa\uff1a \u7b2c\u4e8c\u6b65\uff1a\u521b\u5efa\u8868 \u4f7f\u7528 create table \u8bed\u53e5\uff0c\u540e\u8ddf\u8981\u521b\u5efa\u7684\u8868\u540d\u548c\u5217\u5b9a\u4e49\uff1a CREATE TABLE tablename ( columnname1 datatype, columnname2 datatype, &#8230; ); \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u521b\u5efa\u540d\u4e3a customers \u7684\u8868\uff0c\u5176\u4e2d\u5305\u542b id\uff08\u6574\u6570\uff09\u3001name\uff08\u5b57\u7b26\u4e32\uff09\u548c email\uff08\u5b57\u7b26\u4e32\uff09\u5217\uff0c\u8bf7\u8f93\u5165\uff1a [&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-6198","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6198","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=6198"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6198\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}