{"id":5486,"date":"2021-01-04T11:30:43","date_gmt":"2021-01-04T11:30:43","guid":{"rendered":"https:\/\/blog.gwlin.com\/?p=5486"},"modified":"2023-03-30T08:54:21","modified_gmt":"2023-03-30T08:54:21","slug":"\u4e00\u6b21\u91cd\u88c5mysql\u7684\u8bb0\u5f55","status":"publish","type":"post","link":"https:\/\/www.gwlin.com\/blog\/posts\/5486","title":{"rendered":"\u4e00\u6b21\u91cd\u88c5mysql\u7684\u8bb0\u5f55"},"content":{"rendered":"\n<p>\u4e0a\u4e2a\u661f\u671f\u5929\u4e0b\u5348\u7a81\u7136\u5fc3\u8840\u6765\u6f6e\u60f3\u5347\u7ea7\u4e00\u4e0bvps\u4e0a\u7684mysql \uff0c\u7ed3\u679c\u4e00\u8def\u78d5\u78d5\u78b0\u78b0\uff0c\u4e00\u6298\u817e\u5c31\u662f4\u30015\u4e2a\u5c0f\u65f6\uff0c\u8fd9\u5c31\u662f\u6240\u8c13\u7684\u4f5c\u6b7b\u5427\u3002 \u9996\u5148\uff0c\u91cd\u4e2d\u4e4b\u91cd\u5c31\u662f\u5148\u5b8c\u6574\u5907\u4efd\u539f\u6765\u7684\u6570\u636e\u5e93\uff0c\u8fde\u540c\u7528\u6237\u548c\u6743\u9650\u4e00\u8d77\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\"  lang=\"sql\" class=\"language-sql\">mysqldump -uroot -p --routines --all-databases  --flush-privileges -r xxx.sql<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\uff0c\u5378\u8f7d\u539f\u6765\u7684mysql\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\"  lang=\"sql\" class=\"language-sql\">sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*\nsudo rm -rf \/etc\/mysql \/var\/lib\/mysql\nsudo apt-get autoremove\nsudo apt-get autoclean<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\uff0c\u518d\u5b89\u88c5\u65b0\u7248\u7684mysql\uff0c\u8d34\u4e0amysql\u7684<a href=\"https:\/\/dev.mysql.com\/doc\/mysql-apt-repo-quick-guide\/en\/#repo-qg-apt-select-series\">\u5b98\u65b9\u6559\u7a0b<\/a>\u94fe\u63a5\u5427\u3002\u548c\u522b\u7684\u6559\u7a0b\u4e0d\u540c\uff0c\u5b98\u65b9\u7684\u6559\u7a0b\u4e2d\u8981\u591a\u5b89\u88c5\u4e00\u4e2adeb\u5305\uff0c\u7528\u4e8e apt \u5b89\u88c5 mysql \u7684\u65f6\u5019\u63d0\u793a\u8f93\u5165\u521d\u59cbroot\u5bc6\u7801\uff0c\u5426\u5219\u597d\u50cf\u4f1a\u751f\u6210\u968f\u673a\u5bc6\u7801\uff0c\u6539\u8d77\u6765\u8d85\u7ea7\u4e0d\u65b9\u4fbf\u3002 \u5230\u73b0\u5728\u4e3a\u6b62\u4e00\u5207\u6b63\u5e38\uff0c\u767b\u5165 mysql OK\uff0c\u5bfc\u5165\u521a\u521a\u5907\u4efd\u51fa\u6765\u7684\u6587\u4ef6 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\"  lang=\"sql\" class=\"language-sql\">source xxx.sql<\/code><\/pre>\n\n\n\n<p>\u597d\u4e86\uff0c\u60b2\u5267\u53d1\u751f\u4e86\u3002\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\u5bfc\u5165\u5230\u4e00\u534a\u63d0\u793a\u8fde\u63a5\u4e22\u5931\u9519\u8bef\uff0c\u9000\u51famysql\u540e\u518d\u4e5f\u767b\u5f55\u4e0d\u8fdb\u53bb\u4e86\u3002\u91cd\u542f\u4e00\u4e0b\u770b\u4e00\u4e0b\u5427\uff0c\u7ed3\u679c\u542f\u52a8\u5931\u8d25\uff0c \u3002 \u61d2\u5f97\u7ba1\u4ec0\u4e48\u539f\u56e0\u4e86\uff0c\u53cd\u6b63\u4e5f\u6ca1\u6570\u636e\uff0c\u5e72\u8106\u518d\u91cd\u88c5\u4e00\u6b21\u5427\uff0c\u7ed3\u679c\u7528 apt remove mysql-server \u76f4\u63a5\u5378\u8f7d\u5931\u8d25\uff0c\u63d0\u793a\u627e\u4e0d\u5230\u521a\u521amysql\u5b98\u65b9\u8981\u6c42\u88c5\u7684deb\u5305\u3002\u3002 \u3002\u8981\u7528\u4e0a\u9762\u7ed9\u51fa\u7684\u5378\u8f7dmysql\u65b9\u6cd5\u3002 \u518d\u7136\u540e\uff0c\u5c31\u662f\u75af\u72c2Google\u65f6\u95f4\u4e86\u3002\u5728\u7ffb\u770b\u5404\u79cd\u597d\u50cf\u770b\u5f97\u61c2\u53c8\u770b\u4e0d\u61c2\u7684\u5404\u79cd\u82f1\u8bed\u6587\u7ae0\u7684\u65f6\u5019\uff0c\u5076\u7136\u5728stackoverflow\u770b\u5230\u6709\u4eba\u8bf4\u5bfc\u5165sql\u5927\u6587\u4ef6\u7684\u65f6\u5019\u51fa\u73b0\u9519\u8bef\uff0c\u53ef\u4ee5\u8c03\u9ad8\u6700\u9ad8\u7684query\u5305\u5927\u5c0f\u6765\u907f\u514d\u3002 \u4e00\u8a00\u60ca\u9192\u68a6\u4e2d\u4eba\u554a\uff0cmysql\u5bf9\u6700\u5927\u7684query\u957f\u5ea6\u662f\u6709\u9650\u5236\u7684\u3002\u867d\u7136\u6211\u7684mysql\u6587\u4ef6\u4e5f\u624d50\u591aM\uff0c\u4f46\u8fd8\u662f\u6309\u7167\u7b54\u6848\u6765\u628a\u9650\u5236\u63d0\u9ad8\u3002 \u597d\u4e86\uff0c\u9996\u5148\u8981\u518d\u628amysql\u5378\u8f7d\u4e86\uff0c\u518d\u6b21\u5e72\u51c0\u5b89\u88c5\u3002\u767b\u5f55mysql\uff0c\u8c03\u9ad8\u914d\u7f6e <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\"  lang=\"sql\" class=\"language-sql\">mysql -u root -p\nset global net_buffer_length=1048576;\nset global max_allowed_packet=1073741824;\nset global read_buffer_size=2147479552;\nSET foreign_key_checks = 0;\nsource xxx.sql\nSET foreign_key_checks = 1;<\/code><\/pre>\n\n\n\n<p>\u770b\u7740\u4e00\u884c\u884c\u767d\u8272log\uff0c\u6ca1\u6709\u62a5\u9519\uff0c\u641e\u5b9a\u4e86\u3002\u4f46\u65f6\u95f4\u5df2\u7ecf\u8fc7\u53bb5\u4e2a\u5c0f\u65f6\uff0c\u8fd8\u6ca1\u5403\u5b8c\u996d\u5462\u3002 \u7ecf\u8fc7\u8fd9\u6b21\u4e4b\u540e\uff0c\u5b66\u5230\u7684\u4e0d\u662f\u5bf9mysql\u66f4\u591a\u7684\u6280\u5de7\u548c\u77e5\u8bc6\uff0c\u800c\u662f\uff1a \u6ca1\u4e8b\u522b\u778e\u6298\u817e\uff01 <\/p>\n\n\n\n<p>\u53c2\u8003\u94fe\u63a5\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/askubuntu.com\/questions\/172514\/how-do-i-uninstall-mysql\">https:\/\/askubuntu.com\/questions\/172514\/how-do-i-uninstall-mysql <\/a><a href=\"https:\/\/stackoverflow.com\/questions\/23440800\/large-mysql-dump-failed-to-be-imported\">https:\/\/stackoverflow.com\/questions\/23440800\/large-mysql-dump-failed-to-be-imported<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u4e2a\u661f\u671f\u5929\u4e0b\u5348\u7a81\u7136\u5fc3\u8840\u6765\u6f6e\u60f3\u5347\u7ea7\u4e00\u4e0bvps\u4e0a\u7684mysql \uff0c\u7ed3\u679c\u4e00\u8def\u78d5\u78d5\u78b0\u78b0\uff0c\u4e00\u6298\u817e\u5c31\u662f4\u30015\u4e2a\u5c0f\u65f6\uff0c\u8fd9\u5c31\u662f\u6240 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[179],"tags":[],"class_list":["post-5486","post","type-post","status-publish","format-standard","hentry","category-notes"],"_links":{"self":[{"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/posts\/5486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/comments?post=5486"}],"version-history":[{"count":0,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/posts\/5486\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/media?parent=5486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/categories?post=5486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/tags?post=5486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}