{"id":1229,"date":"2020-07-14T18:23:26","date_gmt":"2020-07-14T09:23:26","guid":{"rendered":"https:\/\/www.kwonline.org\/memo2\/?p=1229"},"modified":"2021-05-25T11:00:43","modified_gmt":"2021-05-25T02:00:43","slug":"mysqldump-to-migrate-remote-mysql-data","status":"publish","type":"post","link":"https:\/\/www.kwonline.org\/memo2\/2020\/07\/14\/mysqldump-to-migrate-remote-mysql-data\/","title":{"rendered":"Ubuntu: WordPress\u306eMySQL\u30c7\u30fc\u30bf\u79fb\u884c"},"content":{"rendered":"<p>WordPress\u306eMySQL\u30db\u30b9\u30c8\u3092\u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u5909\u66f4\u3057\u305f\u306e\u3067\u30e1\u30e2\u3002<\/p>\n<p>\u307e\u305a\u306f\u65b0\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067MySQL5.7\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u4f5c\u696d\u3092\u5b9f\u65bd\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo apt install mysql-server\r\n<\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3089mysql\u306b\u63a5\u7d9a\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo mysql\r\n<\/pre>\n<p>\u521d\u671f\u5316\u306a\u3069\u3002<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n-- create database\r\nCREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;\r\n-- root user\r\nGRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'password';\r\n-- wordpress user\r\nGRANT ALL ON wordpress.* TO 'wpuser'@'%' IDENTIFIED BY 'password';\r\n-- flush\r\nFLUSH PRIVILEGES;\r\n<\/pre>\n<p>localhost\u4ee5\u5916\u304b\u3089\u306e\u63a5\u7d9a\u3092\u8a31\u53ef\u3059\u308b\u305f\u3081\u306bNIC\u306eIP\u30a2\u30c9\u30ec\u30b9\u3092\u8ffd\u52a0<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# \/etc\/mysql\/mysql.conf.d\/mysqld.cnf\r\n# bind-address = 127.0.0.1\r\nbind-address = 10.0.0.2\r\n<\/pre>\n<p>\u3053\u3053\u3067mysql\u3092\u518d\u8d77\u52d5<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl restart msyql\r\n<\/pre>\n<p>\u65e7\u30b5\u30fc\u30d0\u30fc(10.0.0.3)\u306eMySQL\u3092\u30c0\u30f3\u30d7<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ mysqldump --single-transaction -h 10.0.0.3 -u root -p --databases wordpress &gt; db.sql\r\n<\/pre>\n<p>\u30c0\u30f3\u30d7\u304c\u7d42\u308f\u3063\u305f\u3089\u65b0\u30b5\u30fc\u30d0\u30fc(localhost)\u306b\u6295\u5165<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ mysql -u root -p wordpress &lt; db.sql\r\n<\/pre>\n<p>\u30c6\u30fc\u30d6\u30eb\u304c\u5fa9\u5143\u3055\u308c\u3066\u308b\u306e\u3092\u78ba\u8a8d\u5f8c\u306bWordpress\u306e\u63a5\u7d9a\u5148\u3092\u5909\u66f4\u3002<br \/>\nwp-config.php\u3092\u7de8\u96c6\u3059\u308b\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/define( 'DB_HOST', '10.0.0.3' ); \r\ndefine( 'DB_HOST', '10.0.0.4' ); \/\/\u65b0\u30b5\u30fc\u30d0\u30fc\r\n<\/pre>\n<p>\u3053\u308c\u3067\u65b0\u3057\u3044MySQL\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3078\u306e\u79fb\u884c\u5b8c\u4e86\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u306eMySQL\u30db\u30b9\u30c8\u3092\u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u5909\u66f4\u3057\u305f\u306e\u3067\u30e1\u30e2\u3002 \u307e\u305a\u306f\u65b0\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067MySQL5.7\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u4f5c\u696d\u3092\u5b9f\u65bd\u3002 $ sudo apt install mysql-server \u30a4\u30f3\u30b9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,8],"tags":[],"class_list":["post-1229","post","type-post","status-publish","format-standard","hentry","category-data-engineering","category-linux"],"_links":{"self":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/comments?post=1229"}],"version-history":[{"count":6,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1229\/revisions"}],"predecessor-version":[{"id":1235,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1229\/revisions\/1235"}],"wp:attachment":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/media?parent=1229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/categories?post=1229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/tags?post=1229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}