若用户希望在本地PC上连接和管理分析型数据库,则可以使用MySQL官方的命令行工具,或建议使用SQL WorkBench/J工具进行连接和管理。
使用MySQL官方命令行工具时,支持5.1.x/5.5.x/5.6.x版本的MySQL CLI,连接范例如下:
- [backcolor=transparent][[backcolor=transparent]cloud@iZ28unhwyqvZ [backcolor=transparent]~][backcolor=transparent]$ mysql [backcolor=transparent]-[backcolor=transparent]h[backcolor=transparent]<[backcolor=transparent]DOMAIN_URL[backcolor=transparent]>[backcolor=transparent] [backcolor=transparent]-[backcolor=transparent]P[backcolor=transparent]<[backcolor=transparent]PORT[backcolor=transparent]>[backcolor=transparent] [backcolor=transparent]–[backcolor=transparent]u[backcolor=transparent]<[backcolor=transparent]ACCESS_KEY_ID[backcolor=transparent]>[backcolor=transparent] [backcolor=transparent]-[backcolor=transparent]p[backcolor=transparent]<[backcolor=transparent]ACCESS_KEY_SECRET[backcolor=transparent]>[backcolor=transparent] [backcolor=transparent]-[backcolor=transparent]D[backcolor=transparent]<[backcolor=transparent]DB_NAME[backcolor=transparent]>
- [backcolor=transparent]Reading[backcolor=transparent] table information [backcolor=transparent]for[backcolor=transparent] completion of table [backcolor=transparent]and[backcolor=transparent] column names
- [backcolor=transparent]You[backcolor=transparent] can turn off [backcolor=transparent]this[backcolor=transparent] feature to [backcolor=transparent]get[backcolor=transparent] a quicker startup [backcolor=transparent]with[backcolor=transparent] [backcolor=transparent]-[backcolor=transparent]A
- [backcolor=transparent]Welcome[backcolor=transparent] to the [backcolor=transparent]MySQL[backcolor=transparent] monitor[backcolor=transparent].[backcolor=transparent] [backcolor=transparent]Commands[backcolor=transparent] [backcolor=transparent]end[backcolor=transparent] [backcolor=transparent]with[backcolor=transparent] [backcolor=transparent];[backcolor=transparent] [backcolor=transparent]or[backcolor=transparent] \g[backcolor=transparent].
- [backcolor=transparent]Your[backcolor=transparent] [backcolor=transparent]MySQL[backcolor=transparent] connection id [backcolor=transparent]is[backcolor=transparent] [backcolor=transparent]968288632
- [backcolor=transparent]Server[backcolor=transparent] version[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]5.1[backcolor=transparent].[backcolor=transparent]31[backcolor=transparent]-[backcolor=transparent]mysql[backcolor=transparent]-[backcolor=transparent]ads
- [backcolor=transparent]Copyright[backcolor=transparent] [backcolor=transparent]([backcolor=transparent]c[backcolor=transparent])[backcolor=transparent] [backcolor=transparent]2000[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]2013[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]Oracle[backcolor=transparent] [backcolor=transparent]and[backcolor=transparent]/[backcolor=transparent]or[backcolor=transparent] its affiliates[backcolor=transparent].[backcolor=transparent] [backcolor=transparent]All[backcolor=transparent] rights reserved[backcolor=transparent].
- [backcolor=transparent]Oracle[backcolor=transparent] [backcolor=transparent]is[backcolor=transparent] a registered trademark of [backcolor=transparent]Oracle[backcolor=transparent] [backcolor=transparent]Corporation[backcolor=transparent] [backcolor=transparent]and[backcolor=transparent]/[backcolor=transparent]or[backcolor=transparent] its
- [backcolor=transparent]affiliates[backcolor=transparent].[backcolor=transparent] [backcolor=transparent]Other[backcolor=transparent] names may be trademarks of their respective
- [backcolor=transparent]owners[backcolor=transparent].
- [backcolor=transparent]Type[backcolor=transparent] [backcolor=transparent]'help;'[backcolor=transparent] [backcolor=transparent]or[backcolor=transparent] [backcolor=transparent]'\h'[backcolor=transparent] [backcolor=transparent]for[backcolor=transparent] help[backcolor=transparent].[backcolor=transparent] [backcolor=transparent]Type[backcolor=transparent] [backcolor=transparent]'\c'[backcolor=transparent] to clear the current input statement[backcolor=transparent].
- [backcolor=transparent]mysql[backcolor=transparent]>
需要注意的是,连接时建议使用 -D 提前指定数据库名,或是在连接成功后立刻使用use语句切换数据库,否则执行其他命令时会报”only <create database> or <show database> are allowed from admin database connection”错误。
更多的,我们会使用一些本地GUI工具在PC机上进行开发调试,很多工具均能部分上兼容分析型数据库。综合来看兼容性最好的跨平台GUI工具是SQL WorkBench/J,目前可以在
http://www.sql-workbench.net/ 上免费下载。
下载好SQL Workbench/J程序后,还需要下载MySQL JDBC 驱动(如:
http://dev.mysql.com/downloads/connector/j/ 中下载)。下载驱动后,打开SQL WorkBench/J程序,选择 File -> Manage Drivers,选择MySQL后填写刚刚下载的驱动jar包路径。
一切配置完毕后,点击File -> Connect Window,Driver选择MySQL,按照 jdbc:mysql://<Domain_url>:\<Port>/<db_name> 格式填写URL,并在用户名/密码中填写合法账号的ACCESS_KEY_ID和ACCESS_KEY_SECRET,如下图所示:
配置完毕后点击ok,就可以连接到分析型数据库,执行DDL或DML等。