Skip to content

Studio: Fix error connecting to external MySQL database#2393

Merged
gavande1 merged 4 commits intotrunkfrom
stu-1203-mysql-connection-issues
Jan 19, 2026
Merged

Studio: Fix error connecting to external MySQL database#2393
gavande1 merged 4 commits intotrunkfrom
stu-1203-mysql-connection-issues

Conversation

@gavande1
Copy link
Copy Markdown
Contributor

@gavande1 gavande1 commented Jan 14, 2026

Related issues

Proposed Changes

  • I propose to use do-not-attempt-installing WordPress installation mode when site is configured to use MySQL.
  • Otherwise use install-from-existing-files-if-needed as it was configured before.
  • The MySQL config is checked using existence of sqlite plugin directory and db.php.

Why

The actual error is originating from this line in playground CLI. Its part of assertValidDatabaseConnection function where some pre-test are done to make sure sqlite is configured correctly. This validation only runs if either install-from-existing-files-if-needed or download-and-install installation mode is used. You can check condition here. This PR updates WordPress installation mode based on sqlite plugin status to avoid these checks.

Testing Instructions

  1. Create a new site or open an existing one in WordPress Studio
  2. Configure wp-config.php to use an external MySQL database (127.0.0.1). Follow this guide to use Studio with MySQL server.
  3. Start the server - it should attempt to connect to MySQL and server should start normally.
  4. Verify the if site is using MySQL database. Goto Tools -> Site heath -> Info -> Database
CleanShot 2026-01-14 at 17 22 17@2x 5. Check for regression. Existing sites should start normally.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@gavande1 gavande1 force-pushed the stu-1203-mysql-connection-issues branch from af6a699 to 1ad39ad Compare January 14, 2026 12:23
@gavande1 gavande1 self-assigned this Jan 14, 2026
@gavande1 gavande1 changed the title STU-1203: Fix MySQL connection issues Studio: Fix error connecting to external MySQL database Jan 14, 2026
@gavande1 gavande1 requested a review from a team January 14, 2026 12:46
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Jan 14, 2026

📊 Performance Test Results

Comparing c05a225 vs trunk

site-editor

Metric trunk c05a225 Diff Change
load 2882.00 ms 2884.00 ms +2.00 ms 🔴 0.1%

site-startup

Metric trunk c05a225 Diff Change
siteCreation 8071.00 ms 8109.00 ms +38.00 ms 🔴 0.5%
siteStartup 3943.00 ms 3943.00 ms 0.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

Copy link
Copy Markdown
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gavande1 for solving this! I have tested it, and I can now connect to MySql database, while I have an error on trunk. Changes LGTM! :shipit:

Image

Comment thread common/lib/sqlite-integration.ts
Comment thread src/lib/wordpress-provider/playground-cli/playground-cli-provider.ts Outdated
@wojtekn
Copy link
Copy Markdown
Contributor

wojtekn commented Jan 16, 2026

@gavande1 I merged trunk to this branch to run tests with the cli i2 changes.

@gavande1 gavande1 force-pushed the stu-1203-mysql-connection-issues branch from cc8948c to c05a225 Compare January 16, 2026 19:05
@gavande1 gavande1 merged commit 2e32342 into trunk Jan 19, 2026
9 checks passed
@gavande1 gavande1 deleted the stu-1203-mysql-connection-issues branch January 19, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants