[wordpress] How to migrate mysql for wordpress from local to AWS RDS
How to migrate mysql for wordpress from local to AWS RDS, are below
- Create mysql RDS (Instance name, tablename (wordpress,etc) , ID , Password , etc)
- Create security Group for allowing mysql tcp 3306 port and attach this to RDS
- Note RDS Endpoint name
4. Export local mysql data by mysqldump command
mysqldump -u root -p [table名] > backup.sql
5. Import exported date into RDS by mysql command
mysql -u [RDS table username] -p -h [RDS Endpoint] -D [RDS table Name] < backup.sql
6. Modify wp-config.php DB access portion for RDS (endpoint name, table name , ID , password)
For rollback to local, should do reverse task
目次
Memo :
When migrate to RDS, disable local mysql.
when rollback to local, should do enable mysql service at local
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock Error
when access to local mysql, below error was happened and can’t access to mysql
Can't connect to local MySQL server through socket '/tmp/mysql.sock
Eventually, forgot that had disabled mysql service at bitnami by renaming “/opt/bitnami/mysql/scripts/ctl.sh” to “/opt/bitnami/mysql/scripts/ctl.sh.disable”
When same error is happened, no mysql running is suspected, then you should check mysql running status by below command
ps aux | grep mysql
to run mysql at bitnami, you should run below command
sudo /opt/bitnami/ctlscript.sh stop mysql
when you run command but no response, Check existing “/opt/bitnami/mysql/scripts/ctl.sh”
if no and found another name file, you should re-name to original name “/opt/bitnami/mysql/scripts/ctl.sh”