This topic describes how to connect to DRDS to perform subsequent database operations.


  1. Log on to the DRDS console.
  2. In the top navigation bar, select the region where the target instance is located.
  3. Find the target instance and click the instance ID to go to the Basic Information page.
  4. In the left-side navigation pane, click Database Management.
  5. On the Databases page, find the target database and click the database ID to go to the Basic Information page.
  6. In the VPC Address area, find the Command Line Link Address, which contains the DRDS connection string.
  7. After you obtain the DRDS connection string, you can establish a connection to DRDS by using one of the following methods:
    • If you have installed MySQL on your Elastic Compute Service (ECS) instance, you can run the following MySQL command to connect to the DRDS database.
      // Run the MySQL connection command
      mysql -h${DRDS_IP_ADDRESS} -P${DRDS_PORT} -u${user} -p${password} -D${DRDS_DBNAME}
    • You can connect to DRDS by using the following clients. You can go to the corresponding official websites to download the clients.
      • MySQL Workbench (Recommended)
      • SQLyog
      • Sequel Pro
      • Navicat for MySQL
      Note On a third-party graphical user interface (GUI) client, you can perform basic database operations, including data addition, deletion, modification, query, and DDL operations. DRDS may not support the advanced features of the client.
    • You can connect to DRDS by using the following third-party program code that conforms to the official MySQL interactive protocol.
      • JDBC Driver for MySQL (Connector/J)
      • Python Driver for MySQL (Connector/Python)
      • C++ Driver for MySQL (Connector/C++)
      • C Driver for MySQL (Connector/C)
      • ADO.NET Driver for MySQL (Connector/NET)
      • ODBC Driver for MySQL (Connector/ODBC)
      • PHP Drivers for MySQL (mysqli, ext/mysqli, PDO_MYSQL, PHP_MYSQLND)
      • Perl Driver for MySQL (DBD::mysql)
      • Ruby Driver for MySQL (ruby-mysql)


  • Sample code of JDBC Driver for MySQL (Connector/J):
    Connection conn = DriverManager.getConnection("jdbc:mysql://","doc_test","doc_test_password");
  • Connection pool configuration example
    <bean id="dataSource" class="" init-method="init" destroy-method="close"> 
    <property name="url" value="jdbc:mysql://" />
    <property name="username" value="doc_test" />
    <property name="password" value="doc_test_password" />
    <property name="filters" value="stat" />
    <property name="maxActive" value="100" />
    <property name="initialSize" value="20" />
    <property name="maxWait" value="60000" />
    <property name="minIdle" value="1" />
    <property name="timeBetweenEvictionRunsMillis" value="60000" />
    <property name="minEvictableIdleTimeMillis" value="300000" />
    <property name="testWhileIdle" value="true" />
    <property name="testOnBorrow" value="false" />
    <property name="testOnReturn" value="false" />
    <property name="poolPreparedStatements" value="true" />
    <property name="maxOpenPreparedStatements" value="20" />
    <property name="asyncInit" value="true" />
    Note We recommend that you use the Druid connection pool to connect to DRDS. For more information about Druid, see Druid GitHub.