@@ -102,9 +102,40 @@ gcloud app deploy
102102Updating from within the WordPress admin UI will not work because the php72
103103runtime has a mostly read-only file system.
104104
105+ ## Migrating an Existing WordPress Site
106+
107+ To migrate an existing WordPress Site, the first step is to migrate your existing MySQL
108+ database to CloudSQL. This can be done using the ` mysqldump ` command:
109+
110+ 1 . Connect to your existing MySQL server and run these commands:
111+ ``` sh
112+ orig_db_user=[YOUR EXISTING WORDPRESS USER]
113+ orig_db_name=[YOUR EXISTING WORDPRESS DATABASE NAME]
114+ mysqldump --add-drop-table -u ${orig_db_user?} -p ${orig_db_name?} > wpdatabase.sql
115+ ```
116+
117+ 2 . Use ` gsutil ` to move the SQL to a bucket so you can import this into the CloudSQL
118+ instance you created above.
119+ ``` sh
120+ bucket_name=[YOUR CLOUD STORAGE BUCKET NAME]
121+ gsutil cp wpdatabase.sql gs://${bucket_name?}
122+ ```
123+
124+ 3 . Use the [ CloudSQL Import] [ cloudsql-import ] command in ` gcloud ` to complete migrating
125+ your database:
126+ ```
127+ gcloud sql instances import ${db_instance?} gs://${bucket_name?}/wpdatabase.sql \
128+ --database ${db_name?}
129+ ```
130+
131+ 4 . If you have a custom domain, follow the documentation on
132+ [ Mapping Custom Domains] [ mapping-custom-domains ] .
133+
105134[ bash ] : https://www.gnu.org/software/bash/
106135[ cloudshell ] : https://cloud.google.com/shell/docs/quickstart
107136[ create-project ] : https://cloud.google.com/resource-manager/docs/creating-managing-projects
108137[ enable-billing ] : https://cloud.google.com/billing/docs/how-to/modify-project
109138[ install-gcloud ] : https://cloud.google.com/sdk/downloads
110139[ wsl ] : https://docs.microsoft.com/en-us/windows/wsl/install-win10
140+ [ cloudsql-import ] : https://cloud.google.com/sql/docs/mysql/import-export/importing
141+ [ mapping-custom-domains ] : https://cloud.google.com/appengine/docs/standard/php/mapping-custom-domains
0 commit comments