This guide explains three connection scenarios for the Custom MySQL Database feature that archives WooCommerce orders to a MySQL server. Each scenario includes prerequisites, exact steps, example commands, and troubleshooting/security notes.
Scenario 1: Connect to a new or existing database on the same server #
When to use: You want a dedicated archive database on the same MySQL server that already hosts your WordPress DB.
How it works (automatic flow) #
- The system uses the existing WordPress DB credentials (username, password, host, port).
- You provide only the archive database name.
- If the database does not exist, the plugin attempts to create it.
- Plugin creates the required table structure (e.g.,
wp_archived_orders) and confirms the connection.
Prerequisites: WordPress DB user must have CREATE DATABASE privilege. #
Steps (user-facing) #
- In plugin settings, choose Custom MySQL and select the “Same server” option.
- Enter the database name to use (example:
woocommerce_archive). - Save/apply settings.
- Plugin will report success or an error message indicating missing privileges.
What happens behind the scenes (technical) #
- Connects to MySQL using WordPress credentials from
wp-config.php. - Checks for the named database.
- Runs
CREATE DATABASE <database_name>if it doesn’t exist. - Creates tables/schema (e.g.,
wp_archived_orders).
Scenario 2: WordPress DB user lacks CREATE DATABASE privilege #
When it happens: Hosting providers often limit privileges. The plugin will fail when it tries to create a new DB, and your user can only operate inside the existing WordPress DB.
Why this happens #
Managed and strict shared hosts commonly restrict DB users for security. The WordPress user can read/write the WordPress DB, but cannot create new databases.
Error, you’ll see #
A clear permission error indicates that the user cannot execute CREATE DATABASE (or similar privilege error).
Solution options #
Option A — (Recommended for shared hosting) Ask the host support
- Contact your hosting support and request
- Grant your existing WordPress DB user full privileges to create a database
- If they granted privileges to your existing user, proceed using Scenario 1 steps.
Option B — (If you have root/admin access, VPS, or dedicated server)
- Access MySQL as root.
- Create a dedicated user or grant privileges to an existing user.
- Use the credentials (
archive_user+ password) in the plugin.
Notes & security #
- Prefer host-managed creation if you’re on shared hosting — it’s simpler and safer.
- If you create users manually, use strong passwords, and limit host access
localhostwhen possible.
Scenario 3: Remote MySQL connection (database on a different server) #
When to use: You want the archive DB on a separate machine (remote DB server, cloud RDS, another VPS, etc.).
Prerequisites #
- Remote MySQL server reachable from your WordPress server (network, firewall, and routing must allow it).
- MySQL user on the remote server configured to allow remote connections from the WordPress server’s IP (or
%, though more permissive). - Remote DB exists, or the user has
CREATE DATABASEprivilege. - Reasonable network bandwidth for transfers.
Setup steps (detailed) #
- Gather connection info from the remote DB admin/provider:
- Host name or IP (e.g.,
db.example.comor192.168.1.100) - Port (default
3306) - Username and password
- Database name (already created or a name you want to use)
- Host name or IP (e.g.,
- Configure remote server (self-managed MySQL)
- Edit
mysqldconfig:- Set
bind-address = 0.0.0.0(or specific IP) to accept non-local connections. - Ensure
skip-networkingis not enabled.
- Set
- Restart MySQL
- Edit
- Open firewall ports
- On the remote server, allow inbound traffic on MySQL port (3306 by default).
- Enter connection details into the plugin
- Host, Port, Username, Password, Database name.
- Save and let the plugin create tables (if user has privileges) or confirm successful connection.
Add your first comment to this post