Skip to content

Instantly share code, notes, and snippets.

@wickywills
Created August 16, 2019 09:13
Show Gist options
  • Save wickywills/6bd80727e4e6b2f7122a299756a30142 to your computer and use it in GitHub Desktop.
Save wickywills/6bd80727e4e6b2f7122a299756a30142 to your computer and use it in GitHub Desktop.
## Creating a web server
1. Within Google Cloud Platform, open the left menu and select **Compute Engine > VM instances**
2. Select **Create instance** from the top menu
3. Create the server depending on what specification you need and check the boxes to **Allow HTTP/HTTPS traffic** so that it can be viewed in a browser, then select **Save** when done.
4. (optional) SSH into the server and install the LAMP/LEMP stack depending on your requirements.
## Creating a database server
1. Within Google Cloud Platform, open the left menu and select **SQL**
2. Select **Create instance** from the top menu
3. Select **MySQL** (unless you have a need to use PostgreSQL)
4. Give your instance a name and be sure to record the Root password, then when done, select **Create**
## Accessing MySQL from your VM instance
1. Firstly you need to install MySQL client on your VM. To do this, SSH into the server and run the following:
```
sudo apt-get update
sudo apt-get install mysql-client
```
2. Next you need to allow the SQL instance to be accessible to your VM instance. Open the left menu again and select *SQL*
3. Select your instance then select the *Connections* tab
4. Under **Connectivity**, add a new network under **Authorized networks** and enter the IP address of your VM instance
5. Now SSH into your VM instance and try to log into MySQL using something like (entering Root password when prompted):
```
mysql -h[IP ADDRESS OF SQL INSTANCE] -uroot -p
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment