{"id":3629,"date":"2025-03-01T12:35:09","date_gmt":"2025-03-01T03:35:09","guid":{"rendered":"https:\/\/blue-bear.jp\/kb\/?p=3629"},"modified":"2025-03-01T12:36:15","modified_gmt":"2025-03-01T03:36:15","slug":"wordpress%e3%81%ae%e6%89%8b%e5%8b%95%e5%bc%95%e3%81%a3%e8%b6%8a%e3%81%97%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blue-bear.jp\/kb\/wordpress%e3%81%ae%e6%89%8b%e5%8b%95%e5%bc%95%e3%81%a3%e8%b6%8a%e3%81%97%e6%96%b9%e6%b3%95\/","title":{"rendered":"WordPress\u306e\u624b\u52d5\u5f15\u3063\u8d8a\u3057\u65b9\u6cd5"},"content":{"rendered":"\n<p>WordPress\u306e\u624b\u52d5\u5f15\u3063\u8d8a\u3057\uff08\u79fb\u884c\uff09\u3092\u884c\u3046\u969b\u306b\u306f\u3001\u30b5\u30a4\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u5f97\u3057\u3001\u65b0\u3057\u3044\u74b0\u5883\u3078\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001<code>lftp<\/code> \u3092\u4f7f\u7528\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u3068 <code>mysqldump<\/code> \u3092\u4f7f\u7528\u3057\u305f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u30fb\u30a4\u30f3\u30dd\u30fc\u30c8\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>WordPress\u5f15\u3063\u8d8a\u3057\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\u3001\u3042\u307e\u308a\u306b\u5927\u304d\u3044\u5f15\u3063\u8d8a\u3057\u30b5\u30a4\u30ba\u306b\u306a\u308b\u5834\u5408\u306f\u5f15\u3063\u8d8a\u3057\u3067\u304d\u306a\u3044\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3053\u3061\u3089\u304c\u78ba\u5b9f\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. WordPress\u30b5\u30a4\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/h3>\n\n\n\n<p>\u307e\u305a\u3001\u73fe\u5728\u306e\u30b5\u30fc\u30d0\u30fc\u304b\u3089WordPress\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30ed\u30fc\u30ab\u30eb\u3078\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">(1) <code>lftp<\/code> \u3092\u4f7f\u7528\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u79fb\u52d5<\/h4>\n\n\n\n<p><code>lftp<\/code> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u30ea\u30e2\u30fc\u30c8\u74b0\u5883\u3078WordPress\u306e\u30c7\u30fc\u30bf\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>WordPress\u30b5\u30fc\u30d0\u306bSSH\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u304b\u3089<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd .\/&lt;wordpress\u306e\u30e1\u30a4\u30f3\u30d5\u30a9\u30eb\u30c0\u3078\u79fb\u52d5>\nlftp -p &lt;port\u756a\u53f7> -u &lt;SSH\u63a5\u7d9a\u30e6\u30fc\u30b6> sftp:\/\/&lt;SSH\u30b5\u30fc\u30d0>\ncd .\/&lt;\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u306ewordpress\u306e\u30e1\u30a4\u30f3\u30d5\u30a9\u30eb\u30c0\u3078\u79fb\u52d5>\nls<\/code><\/pre>\n\n\n\n<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u306b\u63a5\u7d9a\u3057\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u4e00\u89a7\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306b\u3001<code>mirror<\/code> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u3001\u30b5\u30a4\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mirror --verbose -R -P 4 .\/ .\/<\/code><\/pre>\n\n\n\n<ul>\n<li><code>--verbose<\/code> : \u8a73\u7d30\u306a\u30ed\u30b0\u3092\u8868\u793a<\/li>\n\n\n\n<li><code>-R<\/code> : \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u518d\u5e30\u7684\u306b\u53d6\u5f97<\/li>\n\n\n\n<li><code>-P 4<\/code> : \u4e26\u5217\u51e6\u7406\u30924\u30b9\u30ec\u30c3\u30c9\u3067\u5b9f\u884c<\/li>\n\n\n\n<li>.\/: \u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u30fc\u306eWordPress\u30d5\u30a9\u30eb\u30c0<\/li>\n\n\n\n<li><code>.\/<\/code> : \u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u306e\u4fdd\u5b58\u5148<\/li>\n<\/ul>\n\n\n\n<p>mirror\u306f\u5b8c\u5168\u306b\u540c\u671f\u3059\u308b\u306e\u3067\u3001\u30ea\u30e2\u30fc\u30c8\u5148\u304c\u6b63\u3057\u3044\u3053\u3068\u3001\u30ea\u30e2\u30fc\u30c8\u5148\u306b\u91cd\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046<\/p>\n\n\n\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u30ed\u30fc\u30ab\u30eb\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304c\u3067\u304d\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. WordPress\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/h3>\n\n\n\n<p>WordPress\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306f <code>mysqldump<\/code> \u3092\u4f7f\u7528\u3057\u3066\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">(1) \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u5404\u30c6\u30fc\u30d6\u30eb\u3092\u500b\u5225\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/h4>\n\n\n\n<p>\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u5404Table\u3092IMPORT\u3059\u308bSQL\u30d5\u30a1\u30a4\u30eb\u3092\u500b\u5225\u3067\u751f\u6210\u3057\u307e\u3059\u3002PHPMYADMIN\u306eExport\u3060\u3068SQL\u30d5\u30a1\u30a4\u30eb\u304c1\u3064\u306e\u305f\u3081\u3001\u5927\u304d\u3059\u304e\u308bSQL\u304c\u30a4\u30f3\u30dd\u30fc\u30c8\u5148\u3067\u30a4\u30f3\u30dd\u30fc\u30c8\u3067\u304d\u306a\u3044\u305f\u3081\u3067\u3059<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for table in $(sudo mysql -D bitnami_wordpress -u bn_wordpress -p -e 'SHOW TABLES;' -s --skip-column-names); do\n  sudo mysqldump -u bn_wordpress -p bitnami_wordpress \"$table\" \\\n    --no-tablespaces --skip-lock-tables --single-transaction --quick --compact > \"${table}.sql\"\ndone<\/code><\/pre>\n\n\n\n<p>\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u3001\u4ee5\u4e0b\u306e\u51e6\u7406\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul>\n<li><code>SHOW TABLES;<\/code> \u3092\u5b9f\u884c\u3057\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u4e00\u89a7\u3092\u53d6\u5f97<\/li>\n\n\n\n<li>\u5404\u30c6\u30fc\u30d6\u30eb\u3092\u500b\u5225\u306b\u30c0\u30f3\u30d7\uff08\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\uff09\u3057\u3001<code>table_name.sql<\/code> \u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58<\/li>\n\n\n\n<li><code>--no-tablespaces<\/code> : InnoDB\u30c6\u30fc\u30d6\u30eb\u30b9\u30da\u30fc\u30b9\u306e\u60c5\u5831\u3092\u542b\u3081\u306a\u3044<\/li>\n\n\n\n<li><code>--skip-lock-tables<\/code> : \u30ed\u30c3\u30af\u3092\u56de\u907f\u3057\u3001\u51e6\u7406\u3092\u9ad8\u901f\u5316<\/li>\n\n\n\n<li><code>--single-transaction<\/code> : \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30921\u56de\u3060\u3051\u5b9f\u884c\u3057\u3066\u6574\u5408\u6027\u3092\u78ba\u4fdd<\/li>\n\n\n\n<li><code>--quick --compact<\/code> : \u30c7\u30fc\u30bf\u306e\u30c0\u30f3\u30d7\u3092\u9ad8\u901f\u5316<\/li>\n<\/ul>\n\n\n\n<p>\u901a\u5e38\u306emysqldump\u3060\u3068LOCK TABLE\u304c\u5165\u3063\u3066\u3057\u307e\u3044\u3001\u30a4\u30f3\u30dd\u30fc\u30c8\u306e\u969b\u306b\u56fa\u307e\u308b\u5834\u5408\u304c\u3042\u308b\u306e\u3067LOCK TABLE\u3092\u5165\u3089\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u3059\u3079\u3066\u306e\u30c6\u30fc\u30d6\u30eb\u306eSQL\u30d5\u30a1\u30a4\u30eb\u304c\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30ed\u30fc\u30ab\u30eb\u306eWordPress\u30d5\u30a9\u30eb\u30c0\u3092\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u30fc\u3078\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u3078\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30a4\u30f3\u30dd\u30fc\u30c8<\/h3>\n\n\n\n<p>\u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u306b\u5148\u307b\u3069\u306eSQL\u30d5\u30a1\u30a4\u30eb\u305f\u3061\u3092\u30b3\u30d4\u30fc\u3057\u3066\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3057\u3001\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3057\u305fSQL\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for file in *.sql; do\n  mysql -u new_db_user -p new_database &lt; \"$file\"\ndone\n<\/code><\/pre>\n\n\n\n<ul>\n<li><code>new_db_user<\/code> : \u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u306eMySQL\u30e6\u30fc\u30b6\u30fc\u540d<\/li>\n\n\n\n<li><code>new_database<\/code> : \u65b0\u3057\u3044\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d<\/li>\n\n\n\n<li><code>*.sql<\/code> : \u3059\u3079\u3066\u306eSQL\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. <code>wp-config.php<\/code> \u306e\u8a2d\u5b9a\u3092\u66f4\u65b0<\/h3>\n\n\n\n<p>\u65b0\u3057\u3044\u30b5\u30fc\u30d0\u30fc\u3067 <code>wp-config.php<\/code> \u3092\u7de8\u96c6\u3057\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u60c5\u5831\u3092\u66f4\u65b0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('DB_NAME', 'new_database');\ndefine('DB_USER', 'new_db_user');\ndefine('DB_PASSWORD', 'new_db_password');\ndefine('DB_HOST', 'localhost');\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. \u30d1\u30fc\u30de\u30ea\u30f3\u30af\u8a2d\u5b9a\u3092\u30ea\u30bb\u30c3\u30c8<\/h3>\n\n\n\n<p>\u7ba1\u7406\u753b\u9762\uff08<code>\/wp-admin\/<\/code>\uff09\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3001[\u8a2d\u5b9a] \u2192 [\u30d1\u30fc\u30de\u30ea\u30f3\u30af] \u3067\u300c\u5909\u66f4\u3092\u4fdd\u5b58\u300d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001.htaccess\u306e\u8a2d\u5b9a\u304c\u66f4\u65b0\u3055\u308c\u3001\u6b63\u5e38\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h3>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u3067\u3001WordPress\u306e\u624b\u52d5\u79fb\u884c\u304c\u5b8c\u4e86\u3057\u307e\u3059\u3002\u624b\u9806\u3092\u6574\u7406\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ol>\n<li><code>lftp<\/code> \u3067WordPress\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/li>\n\n\n\n<li><code>mysqldump<\/code> \u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30a8\u30af\u30b9\u30dd\u30fc\u30c8<\/li>\n\n\n\n<li>MySQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30a4\u30f3\u30dd\u30fc\u30c8<\/li>\n\n\n\n<li><code>wp-config.php<\/code> \u3092\u66f4\u65b0<\/li>\n\n\n\n<li>\u30d1\u30fc\u30de\u30ea\u30f3\u30af\u3092\u518d\u8a2d\u5b9a<\/li>\n<\/ol>\n\n\n\n<p>\u30c8\u30e9\u30d6\u30eb\u3092\u907f\u3051\u308b\u305f\u3081\u3001\u79fb\u884c\u524d\u306b\u306f\u5341\u5206\u306a\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u306e\u624b\u52d5\u5f15\u3063\u8d8a\u3057\uff08\u79fb\u884c\uff09<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[541,540],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/3629"}],"collection":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/comments?post=3629"}],"version-history":[{"count":2,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/3629\/revisions"}],"predecessor-version":[{"id":3632,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/3629\/revisions\/3632"}],"wp:attachment":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media?parent=3629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/categories?post=3629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/tags?post=3629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}