Use a MySQL client to connect to and use LindormTable

Updated at: 2024-12-31 01:33

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

Usage notes

  • MySQL clients whose version are 8.0 and earlier 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.

    Important

    Exercise caution when you establish an unencrypted connection over the Internet.

  • By default, MySQL clients whose versions are 8.0 and earlier use the mysql_native_password protocol for authentication. The authentication may fail because specific LindormTable versions are required when you use MySQL in Lindorm. MySQL clients whose versions are 8.0 and earlier do not support the caching_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.

    Important

    Exercise 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 Advanced Packaging Tool (APT) in Linux, run the following command to install the MySQL client:

      sudo apt-get install mysql-client
    • If you use Yellowdog Updater Modified (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

  1. Run the following command to connect to LindormTable:

    mysql --get-server-public-key -h<mysql url> -P33060 -u<Username> -p<Password> -D<Database>
    Note

    You can add the --get-server-public-key parameter to prevent the Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection. error message.

    The following table describes the parameters that you can configure in the preceding command.

    Parameter

    Example

    Method to obtain the parameter value

    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.

    Important
    • If your application is deployed on an Elastic Compute Service (ECS) instance, we recommend that you use a virtual private cloud (VPC) connection to access the Lindorm instance to ensure higher security and lower network latency.

    • If your application is deployed on an on-premises 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, choose Database Connections > Wide Table Engine. 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 to which you want to connect. If you do not specify a database, the client is connected to the default database.

  2. Perform operations in LindormTable.

    1. Create a database named test1.

      CREATE DATABASE test1; 
    2. Use the test1 database.

      USE test1; 
    3. 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'); 
    4. Query data in the tb table.

      SELECT * FROM tb;

      The following result is returned:

      +------+------+---------+
      | id   | name | address |
      +------+------+---------+
      | 001  | jack | hz      |
      +------+------+---------+

  • On this page (1, T)
  • Prerequisites
  • Usage notes
  • Procedure
  • Install a MySQL client
  • Connect and use LindormTable
Feedback
phone Contact Us