Using the local MySQL installation for development
There are several reasons why we wouldn't want to work with a Cloud SQL instance while running our application locally in the development server. We might notice major slowdowns because every time we connect to a Cloud SQL instance, we perform a socket connection to a remote host that can be very far from us. Moreover, regardless of the Cloud SQL tier we choose, we always pay something for using the service and we might not want to use it while experimenting on the local development server.
Fortunately, we can leverage the fact that, in the end, a Cloud SQL instance is nothing more than a MySQL database when our code talks to it. We can then install a local instance of a MySQL server and work with this.
We install and start the local server and perform the same operations we did on the Cloud SQL instance:
- Connect with the MySQL client.
- Create the
notes
database. - Create the
notes
users and give them privileges on thenotes
database. - Reload...