{"id":1693,"date":"2017-01-23T15:51:28","date_gmt":"2017-01-23T07:51:28","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=1693"},"modified":"2017-01-23T15:51:28","modified_gmt":"2017-01-23T07:51:28","slug":"mysql-%e5%88%a0%e9%99%a4%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/mysql-%e5%88%a0%e9%99%a4%e6%95%b0%e6%8d%ae%e5%ba%93\/","title":{"rendered":"MySQL \u5220\u9664\u6570\u636e\u5e93"},"content":{"rendered":"<h2>\u4f7f\u7528 mysqladmin \u5220\u9664\u6570\u636e\u5e93<\/h2>\n<p>\u4f7f\u7528\u666e\u901a\u7528\u6237\u767b\u9646mysql\u670d\u52a1\u5668\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u7279\u5b9a\u7684\u6743\u9650\u6765\u521b\u5efa\u6216\u8005\u5220\u9664 MySQL \u6570\u636e\u5e93\u3002<\/p>\n<p>\u6240\u4ee5\u6211\u4eec\u8fd9\u8fb9\u4f7f\u7528root\u7528\u6237\u767b\u5f55\uff0croot\u7528\u6237\u62e5\u6709\u6700\u9ad8\u6743\u9650\uff0c\u53ef\u4ee5\u4f7f\u7528 mysql mysqladmin \u547d\u4ee4\u6765\u521b\u5efa\u6570\u636e\u5e93\u3002<\/p>\n<p>\u5728\u5220\u9664\u6570\u636e\u5e93\u8fc7\u7a0b\u4e2d\uff0c\u52a1\u5fc5\u8981\u5341\u5206\u8c28\u614e\uff0c\u56e0\u4e3a\u5728\u6267\u884c\u5220\u9664\u547d\u4ee4\u540e\uff0c\u6240\u6709\u6570\u636e\u5c06\u4f1a\u6d88\u5931\u3002<\/p>\n<p>\u4ee5\u4e0b\u5b9e\u4f8b\u5220\u9664\u6570\u636e\u5e93RUNOOB(\u8be5\u6570\u636e\u5e93\u5728\u524d\u4e00\u7ae0\u8282\u5df2\u521b\u5efa)\uff1a<\/p>\n<pre class=\"prettyprint\">[root@host]# mysqladmin -u root -p drop RUNOOB\r\nEnter password:******\r\n<\/pre>\n<p>\u6267\u884c\u4ee5\u4e0a\u5220\u9664\u6570\u636e\u5e93\u547d\u4ee4\u540e\uff0c\u4f1a\u51fa\u73b0\u4e00\u4e2a\u63d0\u793a\u6846\uff0c\u6765\u786e\u8ba4\u662f\u5426\u771f\u7684\u5220\u9664\u6570\u636e\u5e93\uff1a<\/p>\n<pre class=\"prettyprint\">Dropping the database is potentially a very bad thing to do.\r\nAny data stored in the database will be destroyed.\r\n\r\nDo you really want to drop the 'RUNOOB' database [y\/N] y\r\nDatabase \"RUNOOB\" dropped\r\n<\/pre>\n<hr \/>\n<h2>\u4f7f\u7528PHP\u811a\u672c\u5220\u9664\u6570\u636e\u5e93<\/h2>\n<p>PHP\u4f7f\u7528 mysql_query \u51fd\u6570\u6765\u521b\u5efa\u6216\u8005\u5220\u9664 MySQL \u6570\u636e\u5e93\u3002<\/p>\n<p>\u8be5\u51fd\u6570\u6709\u4e24\u4e2a\u53c2\u6570\uff0c\u5728\u6267\u884c\u6210\u529f\u65f6\u8fd4\u56de TRUE\uff0c\u5426\u5219\u8fd4\u56de FALSE\u3002<\/p>\n<h3>\u8bed\u6cd5<\/h3>\n<pre class=\"prettyprint\">bool mysql_query( sql, connection );\r\n<\/pre>\n<table class=\"reference\">\n<tbody>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<tr>\n<td>sql<\/td>\n<td>\u5fc5\u9700\u3002\u89c4\u5b9a\u8981\u53d1\u9001\u7684 SQL \u67e5\u8be2\u3002\u6ce8\u91ca\uff1a\u67e5\u8be2\u5b57\u7b26\u4e32\u4e0d\u5e94\u4ee5\u5206\u53f7\u7ed3\u675f\u3002<\/td>\n<\/tr>\n<tr>\n<td>connection<\/td>\n<td>\u53ef\u9009\u3002\u89c4\u5b9a SQL \u8fde\u63a5\u6807\u8bc6\u7b26\u3002\u5982\u679c\u672a\u89c4\u5b9a\uff0c\u5219\u4f7f\u7528\u4e0a\u4e00\u4e2a\u6253\u5f00\u7684\u8fde\u63a5\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u5b9e\u4f8b<\/h3>\n<p>\u4ee5\u4e0b\u5b9e\u4f8b\u6f14\u793a\u4e86\u4f7f\u7528PHP mysql_query\u51fd\u6570\u6765\u5220\u9664\u6570\u636e\u5e93\uff1a<\/p>\n<pre class=\"prettyprint\">&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=\"utf-8\"&gt; \r\n&lt;title&gt;\u5220\u9664 MySQL \u6570\u636e\u5e93&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;?php\r\n$dbhost = 'localhost:3036';\r\n$dbuser = 'root';\r\n$dbpass = 'rootpassword';\r\n$conn = mysql_connect($dbhost, $dbuser, $dbpass);\r\nif(! $conn )\r\n{\r\n  die('\u8fde\u63a5\u5931\u8d25: ' . mysql_error());\r\n}\r\necho '\u8fde\u63a5\u6210\u529f&lt;br \/&gt;';\r\n$sql = 'DROP DATABASE RUNOOB';\r\n$retval = mysql_query( $sql, $conn );\r\nif(! $retval )\r\n{\r\n  die('\u5220\u9664\u6570\u636e\u5e93\u5931\u8d25: ' . mysql_error());\r\n}\r\necho \"\u6570\u636e\u5e93 RUNOOB \u5220\u9664\u6210\u529f\\n\";\r\nmysql_close($conn);\r\n?&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>\u6ce8\u610f\uff1a<\/strong> \u5728\u4f7f\u7528PHP\u811a\u672c\u5220\u9664\u6570\u636e\u5e93\u65f6\uff0c\u4e0d\u4f1a\u51fa\u73b0\u786e\u8ba4\u662f\u5426\u5220\u9664\u4fe1\u606f\uff0c\u4f1a\u76f4\u63a5\u5220\u9664\u6307\u5b9a\u6570\u636e\u5e93\uff0c\u6240\u4ee5\u4f60\u5728\u5220\u9664\u6570\u636e\u5e93\u65f6\u8981\u7279\u522b\u5c0f\u5fc3\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/www.runoob.com\/mysql\/mysql-drop-database.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 mysqladmin \u5220\u9664\u6570\u636e\u5e93 \u4f7f\u7528\u666e\u901a\u7528\u6237\u767b\u9646mysql\u670d\u52a1\u5668\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u7279\u5b9a\u7684\u6743\u9650\u6765\u521b\u5efa\u6216\u8005\u5220\u9664  &#8230; <a title=\"MySQL \u5220\u9664\u6570\u636e\u5e93\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/mysql-%e5%88%a0%e9%99%a4%e6%95%b0%e6%8d%ae%e5%ba%93\/\" aria-label=\"\u9605\u8bfb MySQL \u5220\u9664\u6570\u636e\u5e93\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,10],"tags":[45],"class_list":["post-1693","post","type-post","status-publish","format-standard","hentry","category-jishu","category-shujuku","tag-mysql"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=1693"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1693\/revisions"}],"predecessor-version":[{"id":1694,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1693\/revisions\/1694"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=1693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=1693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=1693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}