Linux系统连接

<p>本文主要介绍在安装了MySQL客户端的ECS上,如何访问DRDS实例。</p> <p><span style="font-size:18px"><strong>前提条件</strong></span></p> <p>1.&nbsp; 您已成功创建ECS,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/quick_start.Create_ECS" target="_blank">创建ECS</a>,且实例处于运行中。</p> <p>2.&nbsp; 您已在ECS上成功安装MySQL客户端,可参考<a href="https://www.ocftcloud.com/ssr/help/database/RDS/Getting_Started.RDS_MySQL.Connect_RDS_MySQL.Linux" target="_blank">Linux系统连接</a>。</p> <p>3.&nbsp; 您已成功创建DRDS实例,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/quick_start.Create_DRDS" target="_blank">创建DRDS实例</a>,且实例处于运行中。</p> <p>4.&nbsp; 您已成功绑定账号与数据库,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/quick_start.Binding_Account" target="_blank">授权账号与逻辑库权限</a>。</p> <p>5.&nbsp; 您已成功开通白名单,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/quick_start.Create_Whitelist" target="_blank">开通白名单</a>。</p> <p><span style="font-size:18px"><strong>注意事项</strong></span></p> <p>ECS的操作系统请选择CentOS 7.x、RedHat Linux 7.x、Oracle Linux 7.x及以上的版本。</p> <p><span style="font-size:18px"><strong>操作步骤</strong></span></p> <p><span style="font-size:16px"><strong>安装MySQL客户端</strong></span></p> <p>可参考<a href="https://www.ocftcloud.com/ssr/help/database/RDS/Getting_Started.RDS_MySQL.Connect_RDS_MySQL.Linux" target="_blank">Linux系统连接</a>。</p> <p><span style="font-size:16px"><strong>连接DRDS实例</strong></span></p> <p>在MySQL客户端,执行以下命令,连接DRDS实例。</p> <p>&bull;&nbsp;&nbsp; 指定数据库连接:</p> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="background-color:#f7f8fa; vertical-align:top"> <p><span style="font-family:Consolas">mysql -h<em>Domain-name</em> -u<em>Mysql_Account</em> -D<em>Database-name</em> -P<em>Port</em> -p<em>Password</em></span></p> </td> </tr> </tbody> </table> <p>&bull;&nbsp; &nbsp;不指定数据库连接,会连接至默认的系统数据库:</p> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="background-color:#f7f8fa; vertical-align:top"> <p><span style="font-family:Consolas">mysql -h<em>Domain-name</em> -u<em>Mysql_Account</em> -P<em>Port</em> -p<em>Password</em></span></p> <p><span style="font-family:Consolas">use <em>Database-name</em></span></p> </td> </tr> </tbody> </table> <p>&nbsp; &nbsp;&nbsp;<img src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20191909104030-169e38b19d40.png" style="height:26px; margin:0px; width:65px" />:</p> <p>&nbsp; &nbsp;&bull;&nbsp;&nbsp; -h&lt;<em>Domain-name</em>&gt;:DRDS实例的访问域名,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/manual.Instance_Management.Configuration_Management.View_Instance" target="_blank">查看实例基本信息</a>。</p> <p>&nbsp; &nbsp;&bull;&nbsp;&nbsp; -P&lt;<em>Port</em>&gt;:DRDS实例的连接端口,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/manual.Instance_Management.Configuration_Management.View_Instance" target="_blank">查看实例基本信息</a>。</p> <p>&nbsp; &nbsp;&bull;&nbsp;&nbsp; -u&lt;<em>Mysql_Account</em>&gt;:连接DRDS实例的账号名称,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/manual.Instance_Management.Account.Create_Account" target="_blank">创建用户</a>。</p> <p>&nbsp; &nbsp;&bull;&nbsp;&nbsp; -<span style="font-family:Microsoft Yahei">p</span>&lt;<em>Password</em>&gt;:创建账号时设置的密码,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/quick_start.Create_User" target="_blank">创建用户</a>。</p> <p>&nbsp; &nbsp;&bull;&nbsp;&nbsp; -D&lt;<em>Databases-name</em>&gt;:连接DRDS实例的逻辑库,可参考<a href="https://www.ocftcloud.com/ssr/help/database/DRDS/manual.Database_Management.DB_Management.Create_Database" target="_blank">创建逻辑库</a>。</p> <p><span style="font-size:18px"><strong>执行结果</strong></span></p> <p>成功连接DRDS实例。</p>
以上内容是否解决了您的问题?
请补全提交信息!
联系我们

电话咨询

400-151-8800

邮件咨询

fincloud@ocft.com

在线客服

工单支持

解决云产品相关技术问题