Mysql database

student_04_ae0f3057a008@cloudshell:~ (qwiklabs-gcp-00-d0141f8044c1)$ gcloud sql  instances list

NAME: myinstance
DATABASE_VERSION: MYSQL_8_0_31
LOCATION: us-west1-a
TIER: db-custom-4-16384
PRIMARY_ADDRESS: 35.233.179.214
PRIVATE_ADDRESS: -
STATUS: RUNNABLE

student_04_ae0f3057a008@cloudshell:~ (qwiklabs-gcp-00-d0141f8044c1)$ gcloud sql connect myinstance --user=root

Allowlisting your IP for incoming connection for 5 minutes...done.                                                                                                                      
Connecting to database with SQL user [root].Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 38
Server version: 8.0.31-google (Google)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database guestbook;

Query OK, 1 row affected (0.01 sec)

mysql> 

mysql> USE guestbook;

Database changed

mysql> CREATE TABLE entries (guestName VARCHAR(255), content VARCHAR(255),
    ->     entryID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(entryID));

Query OK, 0 rows affected (0.04 sec)

mysql>     INSERT INTO entries (guestName, content) values ("first guest", "I got here!");

Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO entries (guestName, content) values ("second guest", "Me too!");

Query OK, 1 row affected (0.01 sec)

mysql> select * from entries;

+--------------+-------------+---------+
| guestName    | content     | entryID |
+--------------+-------------+---------+
| first guest      | I got here! |       1 |
| second guest | Me too!     |       2 |
+--------------+-------------+---------+
2 rows in set (0.00 sec)

mysql> 

No comments:

Post a Comment

AppEngine - Python

tudent_04_347b5286260a@cloudshell:~/python-docs-samples/appengine/standard_python3/hello_world (qwiklabs-gcp-00-88834e0beca1)$ sudo apt upda...