{"id":1198,"date":"2017-10-14T10:07:04","date_gmt":"2017-10-14T01:07:04","guid":{"rendered":"http:\/\/blue-bear.jp\/kb\/?p=1198"},"modified":"2017-10-14T10:07:04","modified_gmt":"2017-10-14T01:07:04","slug":"wordpress-how-to-migrate-mysql-for-wordpress-from-local-to-aws-rds","status":"publish","type":"post","link":"https:\/\/blue-bear.jp\/kb\/wordpress-how-to-migrate-mysql-for-wordpress-from-local-to-aws-rds\/","title":{"rendered":"[wordpress] How to migrate mysql for wordpress from local to AWS RDS"},"content":{"rendered":"<p>How to migrate mysql for wordpress from local to AWS RDS, are below<\/p>\n<ol>\n<li>Create mysql RDS (Instance name, tablename (wordpress,etc) , ID , Password , etc)<\/li>\n<li>Create security Group for allowing mysql tcp 3306 port and attach this to RDS<\/li>\n<li>Note RDS Endpoint name<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1195\" src=\"http:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2017-10-14-9.40.47-300x125.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2017-10-14 9.40.47\" width=\"300\" height=\"125\" srcset=\"https:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2017-10-14-9.40.47-300x125.png 300w, https:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2017-10-14-9.40.47-768x321.png 768w, https:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2017-10-14-9.40.47-1024x427.png 1024w, https:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2017-10-14-9.40.47.png 1428w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>4. Export local mysql data by mysqldump command<\/p>\n<pre>mysqldump -u root -p [table\u540d] &gt; backup.sql<\/pre>\n<p>5. Import exported date into RDS by mysql command<\/p>\n<pre class=\"\">mysql -u [RDS table username] -p -h [RDS Endpoint] -D [RDS table Name] &lt; backup.sql<\/pre>\n<p>6. Modify wp-config.php DB access portion for RDS (endpoint name, table name , ID , password)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1196\" src=\"http:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/migrate-database-rds-17-49701cf1-300x193.png\" alt=\"migrate-database-rds-17-49701cf1\" width=\"300\" height=\"193\" srcset=\"https:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/migrate-database-rds-17-49701cf1-300x193.png 300w, https:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/migrate-database-rds-17-49701cf1-768x493.png 768w, https:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/migrate-database-rds-17-49701cf1-1024x657.png 1024w, https:\/\/blue-bear.jp\/kb\/wp-content\/uploads\/2017\/10\/migrate-database-rds-17-49701cf1.png 1131w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>For rollback to local, should do reverse task<\/p>\n<p>&nbsp;<\/p>\n<h2>Memo :<\/h2>\n<p>When migrate to RDS, disable local mysql.<\/p>\n<p>when\u00a0rollback to local, should do enable mysql service at local<\/p>\n<p>&nbsp;<\/p>\n<h3>Can&#8217;t connect to local MySQL server through socket &#8216;\/tmp\/mysql.sock\u00a0 Error<\/h3>\n<p>when access to local mysql, below error was happened and can&#8217;t access to mysql<\/p>\n<pre>Can't connect to local MySQL server through socket '\/tmp\/mysql.sock<\/pre>\n<p>&nbsp;<\/p>\n<p>Eventually, forgot that had disabled mysql service at bitnami by renaming &#8220;\/opt\/bitnami\/mysql\/scripts\/ctl.sh&#8221; to &#8220;\/opt\/bitnami\/mysql\/scripts\/ctl.sh.disable&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>When same error is happened, no mysql running is suspected, then you should check mysql running status by below command<\/p>\n<pre>ps aux | grep mysql<\/pre>\n<p>&nbsp;<\/p>\n<p>to run mysql at bitnami, you should run below command<\/p>\n<pre>sudo \/opt\/bitnami\/ctlscript.sh stop mysql<\/pre>\n<p>&nbsp;<\/p>\n<p>when you run command but no response, Check existing &#8220;\/opt\/bitnami\/mysql\/scripts\/ctl.sh&#8221;<\/p>\n<p>if no and found another name file, you should re-name to original name &#8220;\/opt\/bitnami\/mysql\/scripts\/ctl.sh&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to migrate mysql<\/p>\n","protected":false},"author":1,"featured_media":1196,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,7],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1198"}],"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=1198"}],"version-history":[{"count":1,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1198\/revisions"}],"predecessor-version":[{"id":1199,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1198\/revisions\/1199"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media\/1196"}],"wp:attachment":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media?parent=1198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/categories?post=1198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/tags?post=1198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}