{"id":1449,"date":"2017-12-08T16:48:11","date_gmt":"2017-12-08T07:48:11","guid":{"rendered":"https:\/\/adan.jp.net\/blog\/?p=1449"},"modified":"2020-01-09T19:15:22","modified_gmt":"2020-01-09T10:15:22","slug":"mysql%e3%83%87%e3%83%bc%e3%82%bf%e3%81%ae%e3%83%90%e3%83%83%e3%82%af%e3%82%a2%e3%83%83%e3%83%97%e3%81%a8%e3%83%aa%e3%82%b9%e3%83%88%e3%82%a2","status":"publish","type":"post","link":"https:\/\/adan.jp.net\/blog\/programing\/1449","title":{"rendered":"mysql\u30c7\u30fc\u30bf\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3068\u30ea\u30b9\u30c8\u30a2"},"content":{"rendered":"\n<p>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3067\u3069\u308c\u3060\u3051\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u52a9\u3051\u3089\u305f\u304b\u3002\u3002\u3002\u904e\u53bb\u306b\u306f\u75db\u3044\u7d4c\u9a13\u3082\u3042\u308b\u79c1\u30e8\u30ca\u30cf\u3067\u3059\u3002<br>\u3068\u3066\u3082\u5358\u7d14\u3067\u3059\u304c\u3001\u3068\u3066\u3082\u91cd\u8981\u306a\u51e6\u7406\u306a\u306e\u3067\u91cd\u5b9d\u3057\u3066\u307b\u3057\u3044\u51e6\u7406\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u50d5\u306f\u3001\u672c\u756a\u306e\u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30ab\u30eb\u306e\u958b\u767a\u74b0\u5883\u306b\u6301\u3063\u3066\u304f\u308b\u3068\u304d\u306b\u3088\u304f\u4f7f\u3044\u307e\u3059\u3002<br>phpMyAdmmin\u3068\u304b\u3067\u3001\u672c\u756a\u304b\u3089\u300c\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u300d\u3057\u3066\u3001\u958b\u767a\u74b0\u5883\u306b\u300c\u30a4\u30f3\u30dd\u30fc\u30c8\u300d\u3068\u3044\u3046\u4f5c\u696d\u3068\u304a\u3093\u306a\u3058\u3067\u3059\u3002<br>\u3067\u3059\u304c\u3001<strong>\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u3067\u884c\u3046\u3068\u5287\u7684\u306b\u901f\u3044<\/strong>\u306e\u3067\u3001\u4eca\u56de\u306f\u30b3\u30de\u30f3\u30c9\u3067\u884c\u3046\u3084\u308a\u65b9\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"hh hh21 wp-block-heading\" id=\"i-0\"><span class=\"ez-toc-section\" id=\"%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%81%94%E3%81%A8%E3%83%95%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%92%E5%8F%96%E3%82%8B%E6%96%B9%E6%B3%95\"><\/span>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3054\u3068\u30d5\u30eb\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u308b\u65b9\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h2><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u6b21<\/p>\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/adan.jp.net\/blog\/programing\/1449\/#%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%81%94%E3%81%A8%E3%83%95%E3%83%AB%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%82%92%E5%8F%96%E3%82%8B%E6%96%B9%E6%B3%95\" >\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3054\u3068\u30d5\u30eb\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u308b\u65b9\u6cd5<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/adan.jp.net\/blog\/programing\/1449\/#%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AE%E3%81%BF%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97\" >\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u307f\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/adan.jp.net\/blog\/programing\/1449\/#%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2%E3%81%A7%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%8F%8D%E6%98%A0%E3%81%99%E3%82%8B\" >\u30ea\u30b9\u30c8\u30a2\u3067\u30c7\u30fc\u30bf\u3092\u53cd\u6620\u3059\u308b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/adan.jp.net\/blog\/programing\/1449\/#%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E3%83%AD%E3%83%BC%E3%82%AB%E3%83%AB%E3%81%AB%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89%E3%81%99%E3%82%8B\" >\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30ab\u30eb\u306b\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n\n<h3 class=\"hh hh30 wp-block-heading\" id=\"i-1\"><span class=\"ez-toc-section\" id=\"%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%81%AE%E3%81%BF%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97\"><\/span>\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u307f\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mysqldump -u root -p DB\u540d &gt; dump_data.sql\n\n\u30db\u30b9\u30c8\u540d\u304c\u300clocalhost\u300d\u3067\u306a\u3044\u5834\u5408\u306f\u3001\u300c-h \u30db\u30b9\u30c8\u540d\u300d\u3092\u4ed8\u3051\u3066\u3042\u3052\u308b\n$ mysqldump -u root -p -h \u30db\u30b9\u30c8\u540d DB\u540d &gt; dump_data.sql<\/code><\/pre>\n\n\n<p><\/p><div class=\"memo \"><div class=\"memo_ttl dfont\"> \u30d5\u30eb\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306e\u969b\u306b\u51fa\u529b\u3055\u308c\u308bSQL<\/div>\u4e0a\u8a18MySQL\u3092dump\u3057\u305f\u969b\u306b\u51fa\u529b\u3055\u308c\u308bSQL\u306e\u5185\u5bb9\u306b\u306f\u3001\u300cDROP\uff08\u524a\u9664\uff09\u300d\u300cCREATE\uff08\u4f5c\u6210\uff09\u300d\u300cINSERT\uff08\u30c7\u30fc\u30bf\u4f5c\u6210\uff09\u300d\u3068\u3044\u3046\u624b\u9806\u3067SQL\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u30ea\u30b9\u30c8\u30a2\u306e\u969b\u306b\u306f\u3044\u3063\u305f\u3093\u3059\u3079\u3066\u524a\u9664\u3055\u308c\u65b0\u3057\u304f\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/div>\n\n\n\n<p>\u5168\u3066\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mysqldump -u root -x --all-databases &gt; dump_all_database.sql<\/code><\/pre>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\u3054\u3068\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mysqldump -u root -p DB\u540d users &gt; table_data.dump<\/code><\/pre>\n\n\n\n<h2 class=\"hh hh21 wp-block-heading\" id=\"i-2\"><span class=\"ez-toc-section\" id=\"%E3%83%AA%E3%82%B9%E3%83%88%E3%82%A2%E3%81%A7%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%8F%8D%E6%98%A0%E3%81%99%E3%82%8B\"><\/span>\u30ea\u30b9\u30c8\u30a2\u3067\u30c7\u30fc\u30bf\u3092\u53cd\u6620\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30ea\u30b9\u30c8\u30a2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mysql -u root -p DB\u540d &lt; dump_data.sql <\/code><\/pre>\n\n\n\n<p><i class=\"fa fa-hand-o-down\"><\/i> \u30c6\u30fc\u30d6\u30eb\u306e\u30ea\u30b9\u30c8\u30a2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mysql -u root -p DB\u540d &lt; table_data.sql <\/code><\/pre>\n\n\n<p>  <\/p><div class=\"sng-box box29\"><div class=\"box-title\">\u30ea\u30e2\u30fc\u30c8\u3067\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3067\u304d\u306a\u3044\u5834\u5408<\/div><div class=\"box-content\">\u30c6\u30fc\u30d6\u30eb\u30ed\u30c3\u30af\u6a29\u9650(LOCK TABLES)\u304c\u306a\u3044\u5834\u5408\u306b<br>\n\u300c<strong>Access denied for user \u2026 when using LOCK TABLES<\/strong>\u300d<br>\n\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3001\u30ea\u30e2\u30fc\u30c8\u63a5\u7d9a\u6642\u306e\u30c7\u30fc\u30bf\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304c\u51fa\u6765\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<br>\n\u305d\u306e\u969b\u306e\u89e3\u6c7a\u65b9\u6cd5\u3068\u3057\u3066\u306f\u3001InnoDB\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u6642\u306b\u30ed\u30c3\u30af\u3092\u53d6\u5f97\u3057\u306a\u3044\u3068\u3044\u3046\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u308b\u3068\u89e3\u6c7a\u3059\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\n<p><strong>\u2013single-transaction<\/strong><\/p>\n<p>\u3068\u3044\u3046\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002<br>\n<\/p><\/div><\/div>\n\n\n\n<p>Windows\u74b0\u5883\u306b\u3042\u308bMySQL\u306b\u30ea\u30b9\u30c8\u30a2\u3059\u308b\u5834\u5408\u306f\u3001\u30b3\u30de\u30f3\u30c9\u304c\u805e\u304b\u306a\u3044\u5834\u5408\u306a\u3069\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u30b3\u30de\u30f3\u30c9\u3067MySQL\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u5f8c\u306b\u3001\u30ea\u30b9\u30c8\u30a2\u3057\u305f\u307b\u3046\u304c\u697d\u304b\u3082\u3057\u308c\u306a\u3044\u3067\u3059\u3002<br> MySQL\u306b\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u30ea\u30b9\u30c8\u30a2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mysql -uroot -p \n&gt; USE DB\u540d\n&gt; SOURCE dump_data.sql<\/code><\/pre>\n\n\n\n<h2 class=\"hh hh21 wp-block-heading\" id=\"i-3\"><span class=\"ez-toc-section\" id=\"%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E3%83%AD%E3%83%BC%E3%82%AB%E3%83%AB%E3%81%AB%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89%E3%81%99%E3%82%8B\"><\/span>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30ab\u30eb\u306b\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Windwos\u74b0\u5883\u306e\u4eba\u306f\u3001\u30b3\u30de\u30f3\u30c9\u3068\u304b\u3067\u306f\u306a\u304f\u300cWinSCP\u300d\u7b49\u306e\u30bd\u30d5\u30c8\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u307b\u3046\u304c\u3044\u3044\u304b\u3082\u3067\u3059\u3002<br>Mac\u3060\u3068\u30c7\u30d5\u30a9\u30eb\u30c8\u3067Unix\u306e\u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u3048\u308b\u306e\u3067\u3001\u30b3\u30de\u30f3\u30c9\u4e00\u3064\u3067\u30b5\u30fc\u30d0\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p> \u30ea\u30e2\u30fc\u30c8 \u2192 \u30ed\u30fc\u30ab\u30eb\u3078\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># scp [\u30e6\u30fc\u30b6\u540d]@[\u30db\u30b9\u30c8\u540d]:[\u30d5\u30a1\u30a4\u30eb\u540d] [\u30ed\u30fc\u30ab\u30eb\u30d1\u30b9(\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u5148)]\n$ scp tanaka@123.123.123.123:\/home\/tanaka\/dump_date.sql \/Users\/yonaha\/Desktop\/<\/code><\/pre>\n\n\n\n<p> \u30ed\u30fc\u30ab\u30eb \u2192 \u30ea\u30e2\u30fc\u30c8\u3078\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># scp [\u30ed\u30fc\u30ab\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u540d] [\u30e6\u30fc\u30b6\u540d]@[\u30db\u30b9\u30c8\u540d]:[\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u5148\u306e\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\n$ scp local_data.zip tanaka\u540d@123.123.123.123:\/home\/tanaka\/upload_data.zip<\/code><\/pre>\n\n\n\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u30e1\u30e2\u66f8\u304d\u3067\u3057\u305f\u3002<\/p>\n<hr><div class='adan_banner'>\n<a href='\/contact'><img src='\/blog\/wp-content\/uploads\/2019\/02\/bosyu_banner.jpeg'><\/a>\n<\/div>  <div class=\"sng-box box26\"><div class=\"box-title\">\u30d7\u30ed\u306b\u805e\u3044\u3066\u307f\u308b<\/div><div class=\"box-content\">\u682a\u5f0f\u4f1a\u793eadan\u306f\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u30ad\u30e3\u30ea\u30a2\u306b\u771f\u5263\u306b\u5411\u304d\u5408\u3063\u3066\u3044\u307e\u3059\u3002<br>\n<strong class='keiko_blue'>\u4f01\u696d\u306e\u60c5\u5831<\/strong>\u3084<strong class='keiko_blue'>\u30a8\u30f3\u30b8\u30cb\u30a2\u3068\u3057\u3066\u306e\u30ad\u30e3\u30ea\u30a2\u30a2\u30c3\u30d7<\/strong>\u306e\u65b9\u6cd5\u3001<strong class='keiko_blue'>\u73fe\u5728\u306e\u5f85\u9047\uff08\u7d66\u6599\u30fb\u5831\u916c\uff09<\/strong>\u3001<strong class='keiko_blue'>\u672a\u7d4c\u9a13\u304b\u3089\u306e\u30b9\u30c6\u30c3\u30d7\u30a2\u30c3\u30d7\u65b9\u6cd5<\/strong>\u306a\u3069\u306e\u3054\u76f8\u8ac7\u3092\u53d7\u3051\u4ed8\u3051\u3066\u3044\u307e\u3059\u3002<br>\n\u304a\u6c17\u8efd\u306b\u304a\u554f\u5408\u305b\u304f\u3060\u3055\u3044\u3002<div class=\"center\"><p>  <a href=\"\/contact\" class=\"btn raised accent-bc strong\">\u304a\u554f\u5408\u305b\u306f\u3053\u3061\u3089<\/a><\/p><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3067\u3069\u308c\u3060\u3051\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u52a9\u3051\u3089\u305f\u304b\u3002\u3002\u3002\u904e\u53bb\u306b\u306f\u75db\u3044\u7d4c\u9a13\u3082\u3042\u308b\u79c1\u30e8\u30ca\u30cf\u3067\u3059\u3002\u3068\u3066\u3082\u5358\u7d14\u3067\u3059\u304c\u3001\u3068\u3066\u3082\u91cd\u8981\u306a\u51e6\u7406\u306a\u306e\u3067\u91cd\u5b9d\u3057\u3066\u307b\u3057\u3044\u51e6\u7406\u3067\u3059\u3002 \u50d5\u306f\u3001\u672c\u756a\u306e\u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30ab\u30eb\u306e\u958b\u767a\u74b0\u5883\u306b\u6301\u3063\u3066\u304f\u308b &#8230; <\/p>\n","protected":false},"author":2,"featured_media":1812,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[55],"class_list":{"0":"post-1449","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-programing","8":"tag-mysql"},"_links":{"self":[{"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/posts\/1449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/comments?post=1449"}],"version-history":[{"count":15,"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/posts\/1449\/revisions"}],"predecessor-version":[{"id":2602,"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/posts\/1449\/revisions\/2602"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/media\/1812"}],"wp:attachment":[{"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/media?parent=1449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/categories?post=1449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adan.jp.net\/blog\/wp-json\/wp\/v2\/tags?post=1449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}