Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
google131729_student@mydb-client:~$ mysql --host=104.154.208.158 -u root -ppassword
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.14-google-log (Google)
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> CREATE DATABASE resources;
Query OK, 1 row affected (0.01 sec)
MySQL [(none)]> USE resources;
Database changed
MySQL [resources]> CREATE TABLE billing
-> (
-> Account_ID varchar(255),
-> Line_Item varchar(255),
-> Start_Time varchar(255),
-> End_Time varchar(255),
-> Project varchar(255),
-> Measurement1 varchar(255),
-> Measurement1_Total_Consumption bigint(255),
-> Measurement1_Units varchar(255),
-> Cost varchar(255),
-> Currency int,
-> Project_Number varchar(255),
-> Project_ID varchar(255),
-> Project_Name varchar(255),
-> Project_Labels varchar(255),
-> Description varchar(255)
-> );
Query OK, 0 rows affected (0.03 sec)
MySQL [resources]> show tables;
+---------------------+
| Tables_in_resources |
+---------------------+
| billing |
+---------------------+
1 row in set (0.00 sec)
MySQL [resources]> describe billing;
+--------------------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------------------+--------------+------+-----+---------+-------+
| Account_ID | varchar(255) | YES | | NULL | |
| Line_Item | varchar(255) | YES | | NULL | |
| Start_Time | varchar(255) | YES | | NULL | |
| End_Time | varchar(255) | YES | | NULL | |
| Project | varchar(255) | YES | | NULL | |
| Measurement1 | varchar(255) | YES | | NULL | |
| Measurement1_Total_Consumption | bigint(255) | YES | | NULL | |
| Measurement1_Units | varchar(255) | YES | | NULL | |
| Cost | varchar(255) | YES | | NULL | |
| Currency | int(11) | YES | | NULL | |
| Project_Number | varchar(255) | YES | | NULL | |
| Project_ID | varchar(255) | YES | | NULL | |
| Project_Name | varchar(255) | YES | | NULL | |
| Project_Labels | varchar(255) | YES | | NULL | |
| Description | varchar(255) | YES | | NULL | |
+--------------------------------+--------------+------+-----+---------+-------+
15 rows in set (0.00 sec)
MySQL [resources]>
google131729_student@mydb-client:~$ mysql --host=104.154.208.158 -u root -ppassword
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 48
Server version: 5.7.14-google-log (Google)
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> use resources'
ERROR 1049 (42000): Unknown database 'resources''
MySQL [(none)]> use resources;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MySQL [resources]> describe billing;
+--------------------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------------------+--------------+------+-----+---------+-------+
| Account_ID | varchar(255) | YES | | NULL | |
| Line_Item | varchar(255) | YES | | NULL | |
| Start_Time | varchar(255) | YES | | NULL | |
| End_Time | varchar(255) | YES | | NULL | |
| Project | varchar(255) | YES | | NULL | |
| Measurement1 | varchar(255) | YES | | NULL | |
| Measurement1_Total_Consumption | bigint(255) | YES | | NULL | |
| Measurement1_Units | varchar(255) | YES | | NULL | |
| Cost | varchar(255) | YES | | NULL | |
| Currency | int(11) | YES | | NULL | |
| Project_Number | varchar(255) | YES | | NULL | |
| Project_ID | varchar(255) | YES | | NULL | |
| Project_Name | varchar(255) | YES | | NULL | |
| Project_Labels | varchar(255) | YES | | NULL | |
| Description | varchar(255) | YES | | NULL | |
+--------------------------------+--------------+------+-----+---------+-------+
15 rows in set (0.00 sec)
MySQL [resources]> SELECT Measurement1, Cost from billing;
+---------------------------------------------------------------------------------+----------+
| Measurement1 | Cost |
+---------------------------------------------------------------------------------+----------+
| com.google.cloud/services/cloud-sql/DiskSpaceGb | 0.000322 |
| com.google.cloud/services/cloud-sql/IpAddress | 0.01 |
| com.google.cloud/services/cloud-sql/StoragePdSsd | 0.003687 |
| com.google.cloud/services/cloud-sql/VM_N1_STANDARD_1_NA | 0.10908 |
| com.google.cloud/services/cloud-storage/BandwidthDownloadAmerica | 0.000067 |
| com.google.cloud/services/cloud-storage/ClassARequestMultiRegional | 0.00081 |
| com.google.cloud/services/cloud-storage/ClassARequestNearline | 0.00001 |
| com.google.cloud/services/cloud-storage/ClassBRequestMultiRegional | 0.000069 |
| com.google.cloud/services/cloud-storage/StorageMultiRegionalUsGbsec | 0 |
| com.google.cloud/services/compute-engine/Licensed1000204Core | 0 |
| com.google.cloud/services/compute-engine/Licensed1000204N1Standard_1 | 0 |
| com.google.cloud/services/compute-engine/Licensed1000204Ram | 0 |
| com.google.cloud/services/compute-engine/Licensed1001006Core | 0.026666 |
| com.google.cloud/services/compute-engine/Licensed1001006N1Standard_2 | 0 |
| com.google.cloud/services/compute-engine/Licensed1001006Ram | 0 |
| com.google.cloud/services/compute-engine/NetworkGoogleEgressNaNa | 0 |
| com.google.cloud/services/compute-engine/NetworkGoogleIngressNaNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInterConnectIngressNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInterRegionEgressNaNa | 0.00001 |
| com.google.cloud/services/compute-engine/NetworkInterRegionIngressApacNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInterRegionIngressEuNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInterRegionIngressNaNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInterZoneEgress | 0.000259 |
| com.google.cloud/services/compute-engine/NetworkInterZoneIngress | 0 |
| com.google.cloud/services/compute-engine/NetworkInternetEgressNaApac | 0 |
| com.google.cloud/services/compute-engine/NetworkInternetEgressNaCn | 0.000001 |
| com.google.cloud/services/compute-engine/NetworkInternetEgressNaEu | 0.000008 |
| com.google.cloud/services/compute-engine/NetworkInternetEgressNaNa | 0.00004 |
| com.google.cloud/services/compute-engine/NetworkInternetIngressApacNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInternetIngressAuNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInternetIngressCnNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInternetIngressEuNa | 0 |
| com.google.cloud/services/compute-engine/NetworkInternetIngressNaNa | 0 |
| com.google.cloud/services/compute-engine/NetworkIntraZoneEgress | 0 |
| com.google.cloud/services/compute-engine/NetworkIntraZoneIngress | 0 |
| com.google.cloud/services/compute-engine/StaticIpCharge | 0.24 |
| com.google.cloud/services/compute-engine/StoragePdCapacity | 0.037269 |
| com.google.cloud/services/compute-engine/VmimageN1Standard_1 | 0.140833 |
| com.google.cloud/services/compute-engine/VmimageN1Standard_2 | 0.133333 |
| com.googleprod/services/stackdriver/Billable_monitored_resource_usage_free_tier | 0 |
| com.google.cloud/services/cloud-sql/DiskSpaceGb | 0.007406 |
| com.google.cloud/services/cloud-sql/IpAddress | 0.23 |
| com.googleapis/services/pubsub/Message_operation | 0 |
| com.googleprod/services/stackdriver/Billable_monitored_resource_usage_free_tier | 0 |
+---------------------------------------------------------------------------------+----------+
44 rows in set (0.00 sec)
MySQL [resources]>
google131729_student@mydb-client:~$ mysqlimport --host=104.154.208.158 --ignore-lines=1 --fields-terminated-by=, resources --verbose --local -u root -ppassword billing.csv
Connecting to 104.154.208.158
Selecting database resources
Loading data from LOCAL file: /home/google131729_student/billing.csv into billing
resources.billing: Records: 44 Deleted: 0 Skipped: 0 Warnings: 44
Disconnecting from 104.154.208.158
google131729_student@mydb-client:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment