Cloud SQL for MySQL is a fully-managed database service that makes it easy to set-up, maintain, manage and administer your relational MySQL databases on Cloud Platform. The Cloud SQL for MySQL connector allows you to access data from Cloud SQL for MySQL databases within Looker Studio.
In this article:Supported versions
The Cloud SQL for MySQL connector was tested on the following MySQL versions:
- 5.6
- 5.7
- 8.0
If you experience issues using a supported version, please let us know in the Looker Studio Help Community. You can add and vote on feature requests here.
How to connect to Cloud SQL for MySQL
A Looker Studio data source can connect to a single Cloud SQL for MySQL database table, or to a custom query you provide.
To connect
- Sign in to Looker Studio.
- In the top left, click then select Data Source.
- Select the Cloud SQL for MySQL connector.
- If asked, authorize Looker Studio to access your data.
- Set up the connection to your database:
Connect with a hostname or IP address
- On the left, select BASIC.
- Enter the connection details:
- Instance Connection Name [see below to find out how to list your instance connections].
- Database
- Username
- Password
Connect with a JDBC URL
- On the left, select JDBC URL.
- Enter the connection details:
- JDBC URL
Example
jdbc:google:mysql:///
- Username
- Password
- JDBC URL
If you use the JDBC hostname option, you can make sure it's accessible with public DNS lookup tools such as Whois.
Note: Looker Studio can't connect to
localhost
. You must use a public hostname or IP address. - Click AUTHENTICATE.
- Select a table from the list or enter a custom query.
Select the CUSTOM QUERY option to provide a SQL query instead of connecting to a single table. Looker Studio uses this custom SQL as an inner select statement for each generated query to the database.
Custom SQL queries may only have a single statement.
For example, the following will not work because it has multiple SQL statements:
DECLARE cost_per_tb_in_dollar FLOAT64 DEFAULT 4.2;
SELECT total_bytes_billed / [1024 * 1024]]* cost_per_tb_in_dollar]/[1024*1024]]] FROM billing-table;
This is also true when exploring from BigQuery: your query result set may only be based on a single statement.
- Click CONNECT.
In a moment, the data source fields list page appears. In the upper right, click CREATE REPORT or EXPLORE to start visualizing your data.
Notes
Find your instance connection name
The instance connection name identifies your instance on Google Cloud. You can get it from the Cloud console, or by using the command line.
Use the console
- Navigate to //console.cloud.google.com/sql/instances
- Click the Instance ID you want to connect to.
- On the left, you'll find connection Name in the "Connect to this instance" section.
Use the command line
To find the connection name using the Cloud command line interface, use the following command:
gcloud sql instances describe [INSTANCE_NAME] | grep connectionName
Permissions
You must have at least cloudsql.client
permission in the Cloud SQL for MySQL project to create the connection. If you don't have [or can't get] this access, you can use the MySQL connector instead.
Network connectivity
The Cloud SQL for MySQL connector supports connections to Cloud SQL for MySQL instances with public IP connectivity and private IP connectivity.
You must configure public IP connectivity or private IP connectivity for your Cloud SQL for MySQL instance before using the Cloud SQL for MySQL connector.
To allow Looker Studio to access data in Cloud SQL and make queries against this data over a private connection, select the Enable private path option under Google Cloud services authorization in your Cloud SQL for MySQL instance settings. Learn more.
Data types
Looker Studio maps your database's native data types to a unified set of data types. If Looker Studio encounters a column in your table or query of an unsupported type, it will not create a field for that column.
Versi merupakan hal yang penting untuk sebuah aplikasi, versi dapat mewakili fitur dan perkembangan aplikasi tersebut agar dapat dengan mudah diketahui oleh user. Selain itu versi dapat menjadi salah satu patokan kompatibilitas untuk mengintegrasikan dengan aplikasi lainnya, Salah satunya pada aplikasi Database MySQL, versi merupakan identitas penting untuk pengembang aplikasi dan Database Administrator.
Cara mengetahui versi Database MySQL
Database MySQL memiliki beberapa cara untuk melihat versi yang tertanam didalamnya. Cara mengetahui versi MySQL dapat menggunakan 2 metode, antara lain menggunakan Command line dan menggunakan aplikasi GUI [Aplikasi berbasis grafis].
Baca Juga :
Sesi Q&A tentang MySQL bersama Rois Korniawan
Menggunakan antarmuka CLI
- Cara pertama adalah menggunakan CLI/Terminal, Pertama-tama pastikan instance database sudah berjalan. Untuk memastikan instance sudah berjalan di background process dapat menggunakan command berikut :
systemctl status mysqld.service
- Jika instance telah berjalan di background process maka akan menghasilkan tampilan CLI seperti berikut :
- Langkah selanjutnya masuk kedalam mysql dengan menggunakan command sebagai berikut :
systemctl status mysqld.service
- Setelah menjalankan command di atas langkah selanjutnya adalah memasukkan password user yag digunakan. Jika password dan user yang digunakan tersedia maka akan masuk ke dalam mysql.
Selanjutnya gunakan query dibawah ini untuk mengetahui versi mysql yang kita gunakan:Mysql> SELECT @@version;
Atau :
Ketika menjalankan query di atas maka hasilnya akan seperti berikut :Dari hasil yang di tampilkan oleh terminal yang saya gunakan dapat terlihat bahwa database MySQL yang saya gunakan adalah veri 8.0.11. Perbedaan pemanggilannya adalah jika yang versi “SELECT @@VERSION” kita memanggil sebuah variable yang berada di database yang isinya adalah versi database yang kita gunakan, jika versi “SELECT VERSION[]” kita memanggil sebuah fungsi yang sudah MySQL sediakan untuk mengetahui versi server yang kita gunakan.
Menggunakan Antarmuka GUI
Yang kedua adalah dengan menggunakan aplikasi antarmuka berbasis GUI, aplikasi yang saya gunakan adalah MySQL Workbench.Jika anda belum memiliki MySQL Workbench maka anda dapat mendownload aplikasi tersebut melalui portal web MySQL : //dev.mysql.com/downloads/workbench/?utm_source=tuicool Aplikasi MySQL workbench yang saya gunakan adalah MySQL Workbench dengan versi 6.3.
- Cara pertama yang harus dilakukan adalah buat sebuah koneksi agar MySQL Workbench dapat membaca data dari server MySQL dengan cara Add Connections.
- Jika connection telah berhasil di tambahkan maka akan muncul icon berupa informasi server yg kita tambahkan di aplikasi MySQL Workbench.
- Klik konfigurasi yang telah dibuat berdasarkan nama server yang anda buat, contoh dari konfigurasi yang saya buat saya berikan nama new_connection.
Jika sudah berhasil maka halaman pertama yang akan di tuju adalah seperti gambar di bawah ini.
4. Untuk mengetahui versi MySQL yang sedang di gunakan caranya cukup dengan menekan Klik pada link “Server Status” yang berada di sebelah kiri aplikasi. Dan hasilnya adalah seperti berikut.
Baca Juga :
PostgreSQL vs MySQL: Mana yang Terbaik dan Cocok untuk Infrastruktur IT Anda?
Demikian trik untuk mengetahui versi database MySQL menggunakan MySQL Workbench Interface dan Command Line Interface.
Untuk kebutuhan manajemen data perusahaan Anda, Anda bisa dapat melihat informasi selengkapnya melalui solusi data management kami, atau kontak langsung tim sales kami untuk info lebih lanjut.