Any easy way to execute `.sql` scripts locally?

Trying to copy / paste some data from my production CMS db → my local CMS db so I don’t have to fetch prod to get content.

I have a .sql file from my prod CMS db, how can I execute this so that it generates the tables / data I need locally?

Would it be easier to get a .db file from prod instead and point my database.js to that?

Please let me know what the easiest solution is! Thanks!!!

This topic has been created from a Discord post (1246128965643407390) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

Hi,

You can get the dump of your prod .SQL to your local and connect to it. You can do this by using mysqldump.

On your local machine Mac.

  • Install mySQL using brew
  • login into mySQL using mysql -u root
  • Create a local database on your mySQL
  • Use your local database created using USE database_name
  • Source for the path where you have your local database using SOURCE inside your mySQL SOURCE /path/my_prod_database.sql
  • SHOW TABLES to be sure you have all
  • Connect to your database using your local config