{"id":853,"date":"2024-06-05T20:36:04","date_gmt":"2024-06-05T12:36:04","guid":{"rendered":"https:\/\/cn.raksmart.com\/blog\/host\/4197.html"},"modified":"2024-06-05T20:36:04","modified_gmt":"2024-06-05T12:36:04","slug":"mysql%e5%a6%82%e4%bd%95%e8%bf%9b%e8%a1%8c%e8%a1%a8%e7%a9%ba%e9%97%b4%e4%bc%a0%e8%be%93","status":"publish","type":"post","link":"https:\/\/cn.raksmart.com\/blog\/%e6%8a%80%e6%9c%af%e6%95%99%e7%a8%8b\/%e4%ba%91%e6%9c%8d%e5%8a%a1-%e6%8a%80%e6%9c%af%e6%95%99%e7%a8%8b\/853.html","title":{"rendered":"MySQL\u5982\u4f55\u8fdb\u884c\u8868\u7a7a\u95f4\u4f20\u8f93"},"content":{"rendered":"<div class=\"entry-content e-content\" itemprop=\"description articleBody\">\n<p>\u5728<a href=\"https:\/\/www.raksmart.com\/cps\/7921\" target=\"_blank\" rel=\"noopener\">MySQL<\/a> 5.6  \u7248\u672c\u4e2d\u5f15\u5165\u4e86\u4e00\u4e2a\u53ef\u79fb\u52a8\u8868\u7a7a\u95f4\u7684\u65b0\u7279\u6027\uff08\u590d\u5236\u7684\u8868\u7a7a\u95f4\u5230\u53e6\u4e00\u4e2a\u670d\u52a1\u5668\uff09\uff0c\u5373<a href=\"https:\/\/www.raksmart.com\/cps\/7921\" target=\"_blank\" rel=\"noopener\">mysql<\/a>\u8868\u7a7a\u95f4\u4f20\u8f93\u3002\u8fd9\u4f7f\u5f97\u6211\u4eec\u4f20\u8f93\u8868\u6216\u8005\u5355\u4e2a\u5e93\u7684\u6570\u636e\u53d8\u5f97\u5341\u5206\u65b9\u4fbf\u3002\u672c\u6587Raksmart\u8fd8\u662f\u9488\u5bf9\u6027\u7684\u4ecb\u7ecd<strong><a href=\"https:\/\/cn.raksmart.com\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"\u72ec\u7acb\u670d\u52a1\u5668\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\">\u72ec\u7acb\u670d\u52a1\u5668<\/a><\/strong>\u4e2dMySQL\u8868\u7a7a\u95f4\u4f20\u8f93\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u4f20\u8f93\u8868\u7a7a\u95f4\u5fc5\u987b\u6ee1\u8db3\u4ee5\u4e0b\u7684\u6761\u4ef6<\/p>\n<p>1.\u5fc5\u987b\u4f7f\u7528\u72ec\u7acb\u8868\u7a7a\u95f4<\/p>\n<p>2.\u4e24\u4e2amysql\u6570\u636e\u5e93\u7684page\u5927\u5c0f\u5fc5\u987b\u4e00\u6837<\/p>\n<p>3.\u4e24\u4e2a\u8868\u7684\u8868\u7ed3\u6784\u5fc5\u987b\u4e00\u6837<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u5bf9lala\u5e93\u4e0b\u9762\u7684score\u8868\u8fdb\u884c\u4f20\u8f93<\/p>\n<p class=\"has-text-color has-vivid-red-color\">\u9996\u5148\uff0c\u5148\u4ece\u4e3b\u5e93\u5bfc\u51fascore<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u5728\u5bfc\u51fa\u4e4b\u524d\u5bf9\u9519\u8bef\u65e5\u5fd7-f\u547d\u4ee4\u8fdb\u884c\u8f93\u51fa\uff0c\u8ddf\u8e2a\u5b83\u505a\u4e86\u4ec0\u4e48<\/p>\n<p>\uff3broot@potato data\uff3d# tail -f error.log<\/p>\n<p>root@localhost:mysql.sock 01:31:46 \uff3blala\uff3d\u300bflush tables score for export;<\/p>\n<p>root@localhost:mysql.sock 02:08:21 \uff3blala\uff3d\u300bselect * from score;<br \/>\n+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>| id | name | score |<\/p>\n<p>+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>| 3 | xiaohong | 99 |<\/p>\n<p>| 2 | xiaoming | 65 |<\/p>\n<p>| 1 | xiaojun | 55 |<\/p>\n<p>+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>3 rows in set \uff080.00 sec\uff09<\/p>\n<p>\u4ee5\u4e0b\u662f\u9519\u8bef\u65e5\u5fd7\u7684\u8f93\u51fa<\/p>\n<p>2016-12-19 01:32:44 25547 \uff3bNote\uff3d InnoDB\uff1a Sync to disk of \u2018\u201clala\u201d\u3002\u201cscore\u201d\u2019<br \/>\nstarted.<\/p>\n<p>2016-12-19 01:32:44 25547 \uff3bNote\uff3d InnoDB\uff1a Stopping purge<\/p>\n<p>2016-12-19 01:32:44 25547 \uff3bNote\uff3d InnoDB\uff1a Writing table metadata to<br \/>\n\u2018\u3002\/lala\/score.cfg\u2019<\/p>\n<p>2016-12-19 01:32:44 25547 \uff3bNote\uff3d InnoDB\uff1a Table \u2018\u201clala\u201d\u3002\u201cscore\u201d\u2019 flushed to<br \/>\ndisk<\/p>\n<p>\u53ef\u89c1\uff0c\u5b83\u9996\u5148\u5bf9\u8868\u505c\u6b62\u64cd\u4f5c\uff0c\u518d\u628ascore\u7684\u6570\u636e\u548c\u5143\u6570\u636e\u5199\u5230\u78c1\u76d8\u3002<\/p>\n<p>\u6b64\u65f6\u53ef\u4ee5\u8bbf\u95ee\u8fd9\u5f20\u8868\uff0c\u4f46\u662f\u4e0d\u80fd\u5bf9\u6570\u636e\u8fdb\u884cDML\u64cd\u4f5c\uff0c\u5982<\/p>\n<p>\u53d1\u8d77\u67e5\u8be2\u8bed\u53e5\uff0c\u6210\u529f<\/p>\n<p>root@localhost:mysql.sock 01:33:11 \uff3b\uff08none\uff09\uff3d\u300bselect * from lala.score;<br \/>\n+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>| id | name | score |<\/p>\n<p>+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>| 3 | xiaohong | 99 |<\/p>\n<p>| 2 | xiaoming | 65 |<\/p>\n<p>| 1 | xiaojun | 55 |<\/p>\n<p>+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>3 rows in set \uff080.00 sec\uff09<\/p>\n<p>\u53d1\u8d77\u63d2\u5165\u8bed\u53e5\uff0c\u4e00\u76f4\u5728\u7b49\u5f85<\/p>\n<p>root@localhost:mysql.sock 01:31:23 \uff3b\uff08none\uff09\uff3d\u300binsert into lala.score<br \/>\nvalues\uff084\uff0c\u2018xiaolin\u2019\uff0c74\uff09;<\/p>\n<p>\u5728\u5e93\u6587\u4ef6\u5939\u4e0b\u9762\u591a\u4e86cfg\u6587\u4ef6<\/p>\n<p>\uff3broot@potato lala\uff3d# ls -l score*<\/p>\n<p>-rw-r\u2014\u2013\u3002 1 mysql mysql 470 Dec 19 02:07 score.cfg<\/p>\n<p>-rw-rw\u2014-\u3002 1 mysql mysql 8618 Dec 19 02:03 score.frm<\/p>\n<p>-rw-r\u2014\u2013\u3002 1 mysql mysql 98304 Dec 19 02:07 score.ibd<\/p>\n<p>\u6211\u4eec\u628acfg\u548cibd\u6587\u4ef6\u5148\u590d\u5236\u5230\/tmp\u76ee\u5f55\u4e0b<\/p>\n<p>\uff3broot@potato lala\uff3d#cp score.cfg \/tmp<\/p>\n<p>\uff3broot@potato lala\uff3d#cp score.ibd \/tmp<\/p>\n<p class=\"has-text-color has-vivid-red-color\">\u7136\u540e\u89e3\u9501\u8868\uff0c\u8ba9\u5916\u90e8\u53ef\u4ee5\u5c3d\u5feb\u8bbf\u95ee\u8868<\/p>\n<p>root@localhost:mysql.sock 01:35:02 \uff3blala\uff3d\u300bunlock tables;<\/p>\n<p>Query OK\uff0c 0 rows affected \uff080.00 sec\uff09<\/p>\n<p>\u5907\u5e93\u6b64\u65f6\u6ca1\u6709\u8be5\u8868<\/p>\n<p>root@localhost:mysql.sock 01:35:28 \uff3blala\uff3d\u300bshow tables;<\/p>\n<p>+\u2014\u2014\u2014\u2014\u2014-+<\/p>\n<p>| Tables_in_lala |<\/p>\n<p>+\u2014\u2014\u2014\u2014\u2014-+<\/p>\n<p>| haha |<\/p>\n<p>| test |<\/p>\n<p>| test1 |<\/p>\n<p>+\u2014\u2014\u2014\u2014\u2014-+<\/p>\n<p>3 rows in set \uff080.00 sec\uff09<\/p>\n<p>\u67e5\u770b\u4e3b\u5e93\u7684score\u5efa\u8868\u8bed\u53e5<\/p>\n<p>root@localhost:mysql.sock 01:37:19 \uff3blala\uff3d\u300bshow create table scoreG<\/p>\n<p>*************************** 1. row ***************************<\/p>\n<p>Table\uff1a score<\/p>\n<p>Create Table\uff1a CREATE TABLE `score` \uff08<\/p>\n<p>`id` int\uff0811\uff09 DEFAULT NULL\uff0c<\/p>\n<p>`name` varchar\uff0815\uff09 DEFAULT NULL\uff0c<\/p>\n<p>`score` int\uff0811\uff09 DEFAULT NULL<\/p>\n<p>\uff09 ENGINE=InnoDB DEFAULT CHARSET=utf8<\/p>\n<p>1 row in set \uff080.00 sec\uff09<\/p>\n<p>\u5728\u4ece\u5e93\u4e0a\u6267\u884c<\/p>\n<p>root@localhost:mysql.sock 02:03:44 \uff3blala\uff3d\u300b CREATE TABLE `score` \uff08<\/p>\n<p>-\u300b `id` int\uff0811\uff09 DEFAULT NULL\uff0c<\/p>\n<p>-\u300b `name` varchar\uff0815\uff09 DEFAULT NULL\uff0c<\/p>\n<p>-\u300b `score` int\uff0811\uff09 DEFAULT NULL<\/p>\n<p>-\u300b \uff09 ENGINE=InnoDB DEFAULT CHARSET=utf8;<\/p>\n<p>Query OK\uff0c 0 rows affected \uff080.02 sec\uff09<\/p>\n<p>\u73b0\u5728score\u8868\u662f\u6ca1\u6709\u6570\u636e\u7684<\/p>\n<p>root@localhost:mysql.sock 02:04:11 \uff3blala\uff3d\u300bselect * from score;<\/p>\n<p>Empty set \uff080.00 sec\uff09<\/p>\n<p>\u5378\u8f7dscore\u8868\u7a7a\u95f4<\/p>\n<p>root@localhost:mysql.sock 02:05:12 \uff3blala\uff3d\u300balter table score discard<br \/>\ntablespace;<\/p>\n<p>Query OK\uff0c 0 rows affected \uff080.02 sec\uff09<\/p>\n<p>\uff3broot@potato lala\uff3d# ls -l score*<\/p>\n<p>-rw-rw\u2014-\u3002 1 mysql mysql 8618 Dec 19 02:03 score.frm<\/p>\n<p>\u5728\u4e3b\u5e93\u4e0a\u628a\u4e24\u4e2a\u6587\u4ef6\u4f20\u5230\u5907\u5e93\u4e0a<\/p>\n<p>\uff3broot@potato lala\uff3d# scp \/tmp\/score*<br \/>\n192.168.161.55:\/data\/mysql\/mytest_3306\/data\/lala<\/p>\n<p>root@192.168.161.55\u2018s password\uff1a<\/p>\n<p>score.cfg 100% 470 0.5KB\/s 00:00<\/p>\n<p>score.ibd 100% 96KB 96.0KB\/s 00:00<\/p>\n<p>\u4fee\u6539\u4f20\u8f93\u8fc7\u53bb\u7684\u6587\u4ef6\u5c5e\u4e3b<\/p>\n<p>\uff3broot@potato lala\uff3d# ls -l score*<\/p>\n<p>-rw-r\u2014\u2013\u3002 1 root root 8618 Dec 19 01:37 score.cfg<\/p>\n<p>-rw-rw\u2014-\u3002 1 mysql mysql 8618 Dec 19 02:03 score.frm<\/p>\n<p>-rw-r\u2014\u2013\u3002 1 root root 98304 Dec 19 01:37 score.ibd<\/p>\n<p>\uff3broot@potato lala\uff3d# chown mysql:mysql score*<\/p>\n<p>\uff3broot@potato lala\uff3d# ls -l score*<\/p>\n<p>-rw-r\u2014\u2013\u3002 1 mysql mysql 470 Dec 19 02:07 score.cfg<\/p>\n<p>-rw-rw\u2014-\u3002 1 mysql mysql 8618 Dec 19 02:03 score.frm<\/p>\n<p>-rw-r\u2014\u2013\u3002 1 mysql mysql 98304 Dec 19 02:07 score.ibd<\/p>\n<p>\u5bfc\u5165score\u8868\u7a7a\u95f4<\/p>\n<p>root@localhost:mysql.sock 02:05:29 \uff3blala\uff3d\u300balter table score import<br \/>\ntablespace; Query OK\uff0c 0 rows affected \uff080.36 sec\uff09<\/p>\n<p>root@localhost:mysql.sock 02:08:21 \uff3blala\uff3d\u300bselect * from score;<br \/>\n+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>| id | name | score |<\/p>\n<p>+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>| 3 | xiaohong | 99 |<\/p>\n<p>| 2 | xiaoming | 65 |<\/p>\n<p>| 1 | xiaojun | 55 |<\/p>\n<p>+\u2014\u2014+\u2014\u2014\u2014-+\u2014\u2014-+<\/p>\n<p>3 rows in set \uff080.00 sec\uff09<\/p>\n<p>\u81f3\u6b64\uff0c\u8868\u7a7a\u95f4\u4f20\u8f93\u6210\u529f<\/p>\n<p>\u66f4\u591a\u5173\u4e8eMySQL\u65b9\u9762\u7684\u5185\u5bb9\u63a8\u8350\u4e86\u89e3<a href=\"https:\/\/cn.raksmart.com\/blog\/knowledge\/717.html\"> \u600e\u6837\u64cd\u4f5c\u7ef4\u62a4MySQL\u6570\u636e\u5e93\u3002<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728MySQL 5.6 \u7248\u672c\u4e2d\u5f15\u5165\u4e86\u4e00\u4e2a\u53ef\u79fb\u52a8\u8868\u7a7a\u95f4\u7684\u65b0\u7279\u6027\uff08\u590d\u5236\u7684\u8868\u7a7a\u95f4\u5230\u53e6\u4e00\u4e2a\u670d\u52a1\u5668\uff09\uff0c\u5373mysq\u2026 <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[684,35],"class_list":["post-853","post","type-post","status-publish","format-standard","hentry","category-1","tag-mysql","tag-35"],"_links":{"self":[{"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/posts\/853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/comments?post=853"}],"version-history":[{"count":0,"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/posts\/853\/revisions"}],"wp:attachment":[{"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/media?parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/categories?post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.raksmart.com\/blog\/wp-json\/wp\/v2\/tags?post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}