If you have a database on your computer that you want to upload to planetscale.com this note will walk you through it.
First head to your planetscale.com dashboard and click the New Database
button.
On the next page click Import
.
For this step you will need to download ngrok.
ngrok
is a tiny tool that exposes a local port to the internet through a URL making it easy to access.
Once you have ngrok
installed run the following command to expose the port your mysyql
server is running on. The default port is 3309
.
If you already have a password for your sql user you're already done with this step! Otherwise run the following commands while connected to your mysql
server:
Now you need to configure a few things in your mysql
server to make it available to Planetscale.
Run the following commands while connected:
When the last command displays a 0
in the output run this command
Use the the url and port displayed by ngrok
.
Then fill in your credentials and click Test connection
. Hopefully this works!
On the next screen just click Enable Primary Mode
and Finish Import
to complete the process.
That's it! Hopefully this helped you get your data imported 🎉