WordPress Database replacing the easy way

Perlat Kociaj
Written by
Perlat Kociaj
Published
Reading time1 min

I published an NPM package a small cli tool which does the exporting and replacing the URL for a WordPress website piece of cake. You can export and replace within 10 seconds (depending the size of the database and how fast you type).

I started this as a project for personal use, but decided to make it as an NPM package and publicly accessible. We all know the ritual for WordPress development.

  • Develop local using docker containers- Use git commit, git push (or FTP upload for old school hardcore people) to deploy- open phpmyadmin, find the database,export the database- find the file in the downloads folder (find which one is the latest from database (2).sql or database (3).sql or database (5).sqlbecause you deleted (4)
    • replace the local url with the staging/production url you can do it by:
        <li>using any text editor to search/replace the url or
        - using a plugin to import and replace url in the database
            
                <li>Install the plugin
                - Configure the plugin
                - Run the search/replace and wait to finish
                - Done Or do the following while you are in your project directory:
            
        </li>
      
  • - run `devild db:export` and follow the instructions to export your database in your current directory - run `devild db:replace` and follow the instructions to replace the url and create another file to keep the original one. - done ( ~10 seconds ⏳ )

This package is available at NPM Registry where you can install it by running yarn global add @perlatsp/devild or npm i -g @perlatsp/devild


Need help with WordPress migrations or ongoing website maintenance? I offer full-service support for WordPress sites.

On this page

0%
Reading progress0%
Perlat Kociaj
Written by

Perlat Kociaj

Full Stack Web Developer

Discussion