LindormTable supports access over MySQL. You can use a MySQL client to connect to LindormTable and use Lindorm SQL to manage data in LindormTable. This topic guides you through how to get started with LindormTable by providing detailed steps from tool download to simple data reading and writing.
Prerequisites
The LindormTable version of the instance is 2.6.0 or later. For more information about how to view or upgrade the version of LindormTable, see Release notes of LindormTable and Upgrade the minor engine version of a Lindorm instance.
The IP address of your client is added to the whitelist of your Lindorm instance. For more information, see Configure whitelists.
The MySQL compatibility feature is enabled for the instance. For more information, see Enable the MySQL compatibility feature.
You understand the instructions for the development based on MySQL. For more information, see Instructions for development based on MySQL.
Usage notes
MySQL clients of the 8.0 and earlier versions use TLS 1.1 as the default security protocol to establish encryption connections. However, Lindorm supports TLS 1.2 as the default security protocol. Therefore, the client may fail to connect to the Lindorm instance due to different TLS versions. In this case, you must add the
--ssl-mode=DISABLED
parameter to the command when you start the MySQL client to establish an unencrypted connection.ImportantExercise caution when you establish an unencrypted connection over the Internet.
By default, MySQL clients of the 8.0 and earlier versions use the
mysql_native_password
protocol for authentication. The authentication may fail because specific LindormTable versions are required when you use MySQL in Lindorm. In addition, MySQL clients of the 8.0 and earlier versions do not support thecaching_sha2_password
protocol for authentication. Therefore, you must add the --enable_cleartext_plugin parameter to the command when you start the MySQL client to transmit the password in plaintext.ImportantExercise caution when you transmit the password in plaintext over the Internet.
Procedure
Install a MySQL client
Install a MySQL client in Linux:
Run one of the following commands based on the management tool that you use in Linux:
If you use APT in Linux, run the following command to install the MySQL client:
sudo apt-get install mysql-client
If you use YUM in Linux, run the following command to install the MySQL client:
sudo yum install mysql
Install a MySQL client in macOS:
Run the following command in Homebrew to install the MySQL client:
brew install mysql-client
Install a MySQL client in Windows:
For more information, see Install the MySQL client.
Connect and use LindormTable
Run the following command to connect to LindormTable:
mysql -h<mysql url> -P33060 -u<Username> -p<Password> -D<Database>
The following table describes the parameters that you can configure in the preceding command.
Parameter
Example
Method to obtain the parameter value
mysql url
ld-uf6k8yqb741t3****-proxy-sql-lindorm-public.lindorm.rds.aliyuncs.com
Obtain the MySQL Compatibility Endpoint on the Wide Table Engine tab of the Lindorm console, and then remove the colon (:) and the port number at the end of the endpoint.
ImportantIf your application is deployed on an ECS instance, we recommend that you use a VPC to connect to the Lindorm instance to ensure higher security and lower network latency.
If your application is deployed on a local server and needs to connect to the Lindorm instance over the Internet, you can perform the following steps to enable the Internet endpoint for the instance in the Lindorm console: In the left-side navigation pane, select
. On the Wide Table Engine tab, click Enable Public Endpoint.
Username
test
The username that you use to connect to LindormTable.
Password
test
The password that corresponds to the username.
Database
default
The LindormTable database that you want to connect. If you do not specify a database, the client is connected to the
default
database.Perform operations in LindormTable.
Create a database named test1.
CREATE DATABASE test1;
Use the test1 database.
USE test1;
Create a table named tb in the test database and insert a row of data into the tb table.
CREATE TABLE tb (id varchar, name varchar, address varchar, primary key(id, name)) ; UPSERT INTO tb (id, name, address) values ('001', 'jack', 'hz');
Query data in the tb table.
SELECT * FROM tb;
The following result is returned:
+------+------+---------+ | id | name | address | +------+------+---------+ | 001 | jack | hz | +------+------+---------+