Skip to content

Instantly share code, notes, and snippets.

@BruceWind
Last active December 5, 2023 08:56
Show Gist options
  • Save BruceWind/d0f5ebcf3e91cc65f3cc30a83764d00f to your computer and use it in GitHub Desktop.
Save BruceWind/d0f5ebcf3e91cc65f3cc30a83764d00f to your computer and use it in GitHub Desktop.
sharing my tricks which I use to manage wordpress.

Set up a wordpress + mysql DB by docker compose

Look this link: https://github.com/bitnami/containers/tree/main/bitnami/wordpress Note that: you could the compose file to change the default password.

In some cases, I might need to establish mysql at outside of the wordpress host:

Establish a mysql my docker

docker run --name mysql \
  -e ALLOW_EMPTY_PASSWORD=yes \
  -e MYSQL_USER=admin \
  -e MYSQL_PASSWORD=123456 \
  -e MYSQL_DATABASE=wordpress \
  -e MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password \
  -p 3307:3006 \
  bitnami/mysql

Backup a mysql DB on linux and save whole database as sql file type

I prfer to use mysqldump to save whole db.

## firstly, you might need to install mysql-client before the command below.
mysqldump -h <domain> -P <port> -u root -p <DB name>  > ./wholedb.sql

Restore mysql db via a sql file

mysql -h 127.0.0.1 -P 3307 -u admin -p wordpress < ./wholedb.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment