Alibaba Cloud offers highly-available on-demand MySQL, SQL Server and PostgreSQL databases as part of their ApsaraDB for RDS (Relational Database Service), you can manage your Alibaba MySQL databases from a Command Line Interface (CLI) on an Alibaba Cloud instance.
First make sure you have created a whitelist group for the IP address of the computer if you are connecting to ApsaraDB for RDS. Once you are connected to your MySQL database, you can execute SQL (Structured Query Language) commands to manage your MySQL instance including creating; users, databases, tables, columns/fields. You can also perform CRUD (Create Read Update and Delete) operations on any database table.
MySQL Show databases command
You can run the command below to view the available databases on your Alibaba MySQL server;
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec)
MySQL Create Database Command
To create a database on your Alibaba MySQL server, use the command below:
mysql> create database test1; Query OK, 1 row affected (0.01 sec)
Remember to replace 'sample2' with the preferred name of your database.
Switching Between Databases in MySQL
You can switch from one database to another one in MySQL via the 'use' command. For instance, to switch to the database that you created above, use the command below:
mysql> use test1 Database changed
MySQL Create Table Command
Once you switch to a database, you can create tables using the syntax below;
create table (field1 datatype, field2 datatype)
MySQL supports a wide range of data types and you can refer to a complete list here
You should use the correct data type depending on the needs of your application.
For instance, to create a table named students with two fields (student_id and student_name), we can use the syntax below:
mysql> CREATE TABLE students (id INT NOT NULL, student_name VARCHAR (30) NOT NULL); Query OK, 0 rows affected (0.01 sec)
MySQL Show Tables Command
To view all tables from the selected database, use the syntax below:
mysql> show tables; +-----------------+ | Tables_in_test1 | +-----------------+ | students | +-----------------+ 1 row in set (0.01 sec)
MySQL Describe Table Command
To get the structure of the table that you have created above, you can use the below SQL statement;
mysql> describe students; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | id | int(11) | NO | | NULL | | | student_name | varchar(30) | NO | | NULL | | +--------------+-------------+------+-----+---------+-------+ 2 rows in set (0.02 sec)
You can manage records and MySQL database users on a MySQL database table via the command line. For details, you can go to this tutorial.
MySQL is one of the most popular relational database management systems (RDBMS). It is secure, scalable and has high performance with around-the-clock uptime guarantee for many websites and applications.
In this tutorial, we will go over the different MySQL joins that you can implement on your application to craft better, faster, optimized and high performing databases on Alibaba Cloud.
A join occurs when two or more tables are joined in an SQL statement. We are going to discuss three types of MySQL joins in this guide:
The syntax of the join command is shown below:
mysql>Select columns from table1 join_type table2 on join_condition
The join condition should follow after the ON keyword. To better understand how MySQL joins works, we will create a test database and populate it with some sample data. For the sake of simplicity, we are going to use a hypothetical store known as mystore.
BLOB is an acronym for Binary Large OBjects. Sometimes, due to security and portability concerns, you may feel the need to save binary data on your MySQL database alongside other related facts. For instance, if you are running a students' database, you may store their photos and scanned PDF documents together with their registration details such as names and addresses.
In this guide, we will show you how you can store binary data on your MySQL database either hosted with Alibaba Cloud ApsaraDB or provisioned on an ECS instance.
MySQL supports 4 types of BLOB data type which only differ in the maximum length of data they can store. Here is a summary of the different types:
Log Service Command Line Interface (CLI) supports almost all operations as web. It also supports integrity check, automatic paging, multiple accounts, and cross-domain replication.
DLA supports Java Database Connectivity (JDBC) that is compatible with MySQL. You can use a MySQL CLI tool to connect to DLA through JDBC.
Data Lake Analytics does not require any ETL tools. This service allows you to use standard SQL syntax and business intelligence (BI) tools to efficiently analyze your data stored in the cloud with extremely low costs.
Cloud native federation analytics across multiple data sources: OSS, PostgreSQL, MySQL (RDS), NoSQL (Table Store), etc.
Log Service is a complete real-time data logging service that has been developed by Alibaba Group. Log Service supports collection, consumption, shipping, search, and analysis of logs, and improves the capacity of processing and analyzing large amounts of logs.
Fully supports real-time and offline computing, and seamlessly connects to Alibaba Cloud software, open-source software, and commercial software.
francisndungu - December 12, 2018
Alibaba Clouder - September 10, 2018
Alibaba Clouder - August 2, 2018
Alibaba Clouder - July 5, 2019
Alibaba Clouder - January 9, 2020
Alibaba Clouder - June 4, 2018
DBStack is an all-in-one database management platform provided by Alibaba Cloud.Learn More
Migrating to fully managed cloud databases brings a host of benefits including scalability, reliability, and cost efficiency.Learn More
Protect, backup, and restore your data assets on the cloud with Alibaba Cloud database services.Learn More
Fully managed and less trouble database servicesLearn More
More Posts by Alibaba Clouder