Switch to a remote/local database

I know that devkinsta will create it’s own instance of the database for us to work. But I want to switch to another database that is hosted locally on my machine (http://localhost/phpmyadmin)

Current: Devkinsta uses Adminer on

I want to use the ones on mphpmyadmin

Is there a way to do this? is wp-config.php and config.json need to be modified?

Hi again @Rosalito_Udtohan

I’ve never tried this before as DevKinsta already has provided that MySQL/MariaDB service which runs on the devkinsta_db container.

While technically we can altering the wp-config.php file with different DB name and host also user/password , but I’m not sure if that local WP site will then be manageable correctly through DevKinsta interface.

I would say not to alter the config.json file as it’s generated automatically by DevKinsta.

Perhaps you would like to give it a try by altering the following lines in your site’s wp-config.php file to something like these:

define( ‘DB_NAME’, ‘yourDBnamehere’ );

/** Database username */
define( ‘DB_USER’, ‘youDBuserhere’ );

/** Database password */
define( ‘DB_PASSWORD’, ‘yourDBpasswordhere’ );

/** Database hostname */
define( ‘DB_HOST’, ‘’ );

then see if you can access your local site URL on your browser if it loads the contents from the database you have on your localhost machine ( . If it’s not working, then you may want to stick with the previous DB settings (using the default one used in DevKinsta).

Best regards,

@Agus I’ve tested it and it functions properly. However, there’s a concern that DevKinsta may not accommodate this setup, which could lead to complications when attempting to push or deploy it to myKinsta Live with this kind of setup. What do you think? Maybe I can try and will let you know on Monday.

@Agus Just as I thought. An error occurred when trying to sync from Local to remote myKinsta server using the custom/local database. Error DK0065. Before I stick to the previous DB settings. Maybe there’s still a way to fix this?

Here’s the log file:
main.log (290.6 KB)

Hey @Rosalito_Udtohan

Thank you for your reply and update!
Yeah, that’s what I thought as well and that’s why I mentioned previously:

While technically we can altering the wp-config.php file with different DB name and host also user/password , but I’m not sure if that local WP site will then be manageable correctly through DevKinsta interface.

(I should also have mentioned about the same concern that DevKinsta might not be able to process the site sync from local to remote MyKinsta server or vice versa, due to this custom DB setup in wp-config.php file).

I would highly recommend to use the default Database service provided by DevKinsta in your wp-config.php (the DB can also be managed through Adminer) instead of using another DB service that’s managed separately on your local computer (through phpMyAdmin) - just to make sure everything will be working properly.

In case you would still want to use that custom local DB in your wp-config.php file, then most likely you will need to do that “push changes” to your MyKinsta server manually (not using DevKinsta’s Sync functions).
Perhaps with something like the following steps (again it’s still my theory, and I haven’t tried this myself with the custom DB setup/settings like you have):

  1. Be sure to make a manual backup of your Staging site first in MyKinsta (just in case).
    Then in DevKinsta, when doing the Sync → Push to Kinsta , you may want to push the “Files” (and folders) only and exclude/un-check the wp-config.php file, and please also un-check the “Database” option. Like this for example:

    See if your local site’s files (and folders, except the wp-config.php file and the database) can be pushed to your Staging site on Kinsta server.

  2. If there’s no issue with the step 1 above, then the next thing is to manually dump/export your local database into a .sql file (e.g.: through phpMyAdmin with its DB export tool).

  3. Upload that .sql dumped/exported file via SFTP to your Staging site on Kinsta server (store it under its ~/public root folder).

  4. Once finished, connect via SSH to your Staging site on our server. Then type: cd ~/public (so you will be working inside the site’s public folder).
    There, you can double check if you can find that .sql file you’ve uploaded via SFTP before (with something like: ls -la thesqlfilename.sql .
    Once you’ve confirmed the .sql file is there, you can type the following to import that .sql file to your database on Kinsta server:
    wp db import thesqlfilename.sql
    (make sure to change the thesqlfilename.sql with your actual .sql. file name).
    You can then free to remove that .sql file you’ve uploaded before (as it’s been imported to your database on our server).

  5. Once the .sql import process has completed, you will also need to perform Search and Replace with something like this:
    wp search-replace 'https://yourlocalsitename.local' 'https://yourstagingsiteurlhere'
    This will make sure to replace all old local site URL with your actual staging site URL in the database on our server.

You may want to give it a try and see if that would work for you, but again, I would still say to use the default database in DevKinsta instead to avoid such extra manual works.

Best regards,

1 Like

Thank you very much for the help @Agus . Will try these, otherwise, will switch to the default database.

1 Like

You’re most welcome @Rosalito_Udtohan :bowing_man: Alright, sounds good!

Best regards,

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.