tencent cloud

Feedback

Basic SQL Operations

Last updated: 2023-11-09 15:02:18
    This document describes common SQL commands.
    For more information on SQL commands, including command parameters and restrictions, see MySQL 5.7 Reference Manual.

    Querying the version

    Option 1:
    MySQL [(none)]> SELECT CYNOS_VERSION();
    +------------------------+
    | CYNOS_VERSION() |
    +------------------------+
    | 5.7.mysql_cynos.1.3.10 |
    +------------------------+
    1 row in set (0.00 sec)
    Option 2:
    MySQL [(none)]> SELECT @@CYNOS_VERSION;
    +------------------------+
    | @@CYNOS_VERSION |
    +------------------------+
    | 5.7.mysql_cynos.1.3.10 |
    +------------------------+
    1 row in set (0.00 sec)
    Option 3:
    MySQL [(none)]> SHOW VARIABLES LIKE 'CYNOS_VERSION';
    +---------------+------------------------+
    | Variable_name | Value |
    +---------------+------------------------+
    | cynos_version | 5.7.mysql_cynos.1.3.10 |
    +---------------+------------------------+
    1 row in set (0.01 sec)

    Database commands

    Command
    Sample
    Create a database and specify the character set
    CREATE DATABASE db01 DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
    Delete a database
    DROP DATABASE db01;

    ‌Account commands

    Command
    Sample
    Create an account
    CREATE USER 'username'@'host' IDENTIFIED BY 'password';
    Delete an account
    DROP USER 'username'@'host';
    Grant permissions
    GRANT SELECT ON db01.* TO 'username'@'host';
    Query an account in the database
    SELECT user,host FROM mysql.user;
    or
    SHOW GRANTS FOR 'username'@'hostname';
    Revoke permissions
    Revoke all permissions: REVOKE ALL PRIVILEGES,GRANT OPTION FROM 'username'@'host';
    Revoke specified permissions: REVOKE UPDATE ON *.* FROM 'username'@'host';
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support