0

Local Wordpress Studio runs on SQLite per default.

How to turn it to MySQL?

There is 0-sqlite.php under mu-plugins, without an option to deactivate it.

I added define( 'DB_DRIVER', 'mysql' ); to wp-config - without effect.

Tried to delete, rename and comment 0-sqlite.php - no effect, Studio rewrites it after restart.

wp-config contains default MySQL connection, without credentials.

1
  • 3
    You need to go to their support for help with this, keep in mind that wP Studio is a product of Automattic not the open source WordPress project, and has a lot of changes incorporated. Most of all there is no MySQL server in WP Studio to switch to, you would need to export your data to a rival product ( Studio doesn't strictly use PHP either, it recompiles your code into JS and runs it on Node via WP Playground )
    – Tom J Nowell
    Commented Oct 23 at 12:38

1 Answer 1

1

To switch your Local WordPress Studio from SQLite to MySQL, the issue you're encountering is likely caused by a persistent setup for SQLite that gets automatically rewritten after restart. Here's a step-by-step process to properly switch the database engine: Steps to Convert from SQLite to MySQL:

Ensure MySQL is set up in Local Studio: Confirm that the local environment has MySQL configured and running. Check for the MySQL database information (host, username, password, etc.). If you don’t have this info, you may need to create a new database in your local MySQL environment for WordPress.

Update wp-config.php with correct MySQL credentials:

Make sure that your wp-config.php has the correct database credentials. Add or update the following lines with your actual MySQL credentials:

define('DB_NAME', 'your_database_name');
define('DB_USER', 'your_database_user');
define('DB_PASSWORD', 'your_database_password');
define('DB_HOST', 'localhost'); // Or your MySQL host

Disable the SQLite Integration: The 0-sqlite.php file in the mu-plugins folder is forcing SQLite usage. Since it rewrites itself after each restart, here’s what you can do:

Option 1: Modify the SQLite plugin configuration Check inside the 0-sqlite.php file or the mu-plugins folder for any configuration options to turn off SQLite support. Look for constants or function calls related to SQLite and modify them if possible.

Option 2: Move or Rename the mu-plugins Folder (Temporary Workaround) Rename the entire mu-plugins folder to something else like mu-plugins-disabled (located in wp-content). This should prevent the auto-loading of 0-sqlite.php and force WordPress to use MySQL.

If you want to preserve this functionality for later, move the mu-plugins folder to a different directory outside the WordPress installation temporarily.

Option 3: Check for Custom Scripts in Local Studio Configuration Some setups in local development environments like "Local" by Flywheel or other studio environments automatically add or manage plugins like SQLite. If there is a custom script or configuration in the development environment that auto-restores the SQLite file, look for that and either disable it or modify the local studio environment to prevent it from overwriting files.

Restart the Environment: Restart your local server environment after making these changes. Test the WordPress site to ensure it is now connected to MySQL by checking the database or using the WordPress dashboard (e.g., install a plugin like WP-DBManager or Query Monitor to confirm the database engine in use).

Export Data from SQLite (if needed): If you need to migrate data from SQLite to MySQL, use a migration plugin like WP All-in-One Migration or manually export/import the data between the two database engines.

By disabling the mu-plugins or forcing WordPress to use the correct MySQL credentials, you should be able to switch the WordPress site to MySQL successfully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.