MemSQL翻译第三天---MemSQL指导
2016-08-30 10:48
288 查看
原文地址 http://docs.memsql.com/docs/tutorials-overview
How to Connect to MemSQL This section outlines several ways to connect to MemSQL using popular MySQL-compatible clients and libraries.
如何连接数据库
这一节列出了几种MySQL兼容的客户端和类课连接MemSQL的方式
MySQL command-line client MemSQL is wire-compliant with MySQL meaning connecting to MemSQL is as easy as connecting to the MySQL database. You may need the -u user, -h host, and -P port flags to ensure you are connecting to MemSQL properly. For example: Connecting with MySQL
client mysql -u root -h 127.0.0.1 -P 3306
MemSQL命令行客户端
MemSQL和MySQL是兼容的,意味着连接MemSQL和连接MySQL是一样方便的,你可能需要-u user,-h host,-P port来确信你能连接到MemSQL,例如:
mysql -u root -h 127.0.0.1 -P 3306
Here we have -u root to specify login as user root, -h 127.0.0.1 to
connect to the MemSQL host at localhost, and -P 3306 to connect to
MemSQL on port 3306.
If you also have MySQL installed, the mysql client may connect to
MySQL instead of MemSQL by default if you do not specify the
appropriate host and port options. If you attempt to connect to MemSQL
on localhost, even if you specify the correct port, the mysql client
may still attempt to connect to MySQL with default configuration. See
this FAQ item on ERROR 2002.
如果你也安装了MySQL,如果你没有使用主机名和端口号,mysql客户端可能连接到MySQL而不是MemSQL,如果你试着在localhost上连接MemSQL,
mysql客户端可能仍然试着连接MySQL,http://docs.memsql.com/docs/memsql-faq#section-what-is-error-2002-which-appears-when-connecting-to-memsql-with-the-stock-mysql-client-using-default-arguments-
You may also use the –prompt flag to change the prompt in the
interactive session, simply to help distinguish MemSQL from MySQL:
Changing the prompt mysql -u root -h 127.0.0.1 -P 3306
–prompt=”memsql> ” The output when you connect should look similar to this: Connect SQL Welcome to the MySQL monitor. Commands end with ; or
\g. Your MySQL connection id is 6 Server version: 5.5.8 MemSQL source
distribution (compatible; MySQL Enterprise & MySQL Commercial)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights
reserved. Oracle is a registered trademark of Oracle Corporation
and/or its affiliates. Other names may be trademarks of their
respective owners. Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear
the current input statement. memsql>
你可能需要使用–prompt来改变交互式session的提示符,这样能把mysql和memsql区分开:
mysql -u root -h 127.0.0.1 -P 3306 –prompt=”memsql> ”
输出看起来大概是这样:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL
connection id is 6 Server version: 5.5.8 MemSQL source distribution
(compatible; MySQL Enterprise & MySQL Commercial) Copyright (c) 2000,
2015, Oracle and/or its affiliates. All rights reserved. Oracle is a
registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners. Type ‘help;’
or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
memsql>
These commands show more information about the connection and the
server:
下面的命令给出更多的信息
Additional information mysql> status
————– mysql Ver 14.14 Distrib 5.6.19, for osx10.9 (x86_64) using EditLine wrapper
Connection id: 6 Current database: Current user:
root@127.0.0.1 SSL: Not in use Current pager:
stdout Using outfile: ” Using delimiter: ; Server
version: 5.5.8 MemSQL source distribution (compatible; MySQL
Enterprise & MySQL Commercial) Protocol version: 10 Connection:
127.0.0.1 via TCP/IP Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 TCP port:
+——————–+ | Database |
+——————–+ | information_schema | | memsql | | sharding |
+——————–+ 3 rows in set (0.00 sec)
mysql> show variables like ‘%version%’;
+————————-+——————————————————————————+ | Variable_name | Value
|
+————————-+——————————————————————————+ | memsql_version | 4.0
| | memsql_version_date | Wed May 6 09:07:03 2015 -0700
| | memsql_version_hash | 0cba132fba0ba7650c1bc9aeec8c1fc381def395
| | protocol_version | 10
| | version | 5.5.8
| | version_comment | MemSQL source distribution (compatible;
MySQL Enterprise & MySQL Commercial) | | version_compile_machine |
x86_64
| | version_compile_os | Linux
|
+————————-+——————————————————————————+ 8 rows in set (0.03 sec)
mysql> show status like ‘%license%’;
+—————+———————————-+ | Variable_name | Value |
+—————+———————————-+ | License_key | 5ca1ab1e000f40aaa6cb67b2ea3ee466 | | License_type | enterprise
|
+—————+———————————-+ 2 rows in set (0.00 sec)
mysql> show status like ‘%cluster_capacity%’;
+————————–+————-+ | Variable_name | Value |
+————————–+————-+ | Maximum_cluster_capacity | 10000000 MB | | Used_cluster_capacity | 107957 MB |
+————————–+————-+ 2 rows in set (0.00 sec)
The @@version and @@version_comment global variables are for
compatibility with MySQL clients, which expect certain minimum
version numbers and strings to be present. To check the real version
of MemSQL you are running, use the @@memsql_version variables
instead. To check the license you are running, see the license_key and
license_type status codes.
全局变量@@version和@@version_comment是为了和MySQL兼容,代表着当前最小的版本,为了得到你的真正的版本,使用@@memsql_version变量,为了
产看你正在运行的许可,看license_key和license_type。
Hibernate You will need JDBC in your classpath to connect to MemSQL.
Make sure you have Hibernate and Maven properly installed. Download
HibernateTutorial.zip. Unzip HibernateTutorial. Initialize your
database. Initialize the database CREATE DATABASE test; USE test;
CREATE TABLE USER (
-> USER_ID INT (5) NOT NULL,
-> USERNAME VARCHAR (20) NOT NULL,
-> CREATED_BY VARCHAR (20) NOT NULL,
-> CREATED_DATE DATE NOT NULL,
-> PRIMARY KEY ( USER_ID )
-> ); Edit HibernateTutorial/src/main/java/resources/hibernate.cfg.xml to match
your MemSQL configuration. For example our user is root with no
password. Our database is on localhost on port 3306. Hibernate
configuration
How to Connect to MemSQL This section outlines several ways to connect to MemSQL using popular MySQL-compatible clients and libraries.
如何连接数据库
这一节列出了几种MySQL兼容的客户端和类课连接MemSQL的方式
MySQL command-line client MemSQL is wire-compliant with MySQL meaning connecting to MemSQL is as easy as connecting to the MySQL database. You may need the -u user, -h host, and -P port flags to ensure you are connecting to MemSQL properly. For example: Connecting with MySQL
client mysql -u root -h 127.0.0.1 -P 3306
MemSQL命令行客户端
MemSQL和MySQL是兼容的,意味着连接MemSQL和连接MySQL是一样方便的,你可能需要-u user,-h host,-P port来确信你能连接到MemSQL,例如:
mysql -u root -h 127.0.0.1 -P 3306
Here we have -u root to specify login as user root, -h 127.0.0.1 to
connect to the MemSQL host at localhost, and -P 3306 to connect to
MemSQL on port 3306.
If you also have MySQL installed, the mysql client may connect to
MySQL instead of MemSQL by default if you do not specify the
appropriate host and port options. If you attempt to connect to MemSQL
on localhost, even if you specify the correct port, the mysql client
may still attempt to connect to MySQL with default configuration. See
this FAQ item on ERROR 2002.
如果你也安装了MySQL,如果你没有使用主机名和端口号,mysql客户端可能连接到MySQL而不是MemSQL,如果你试着在localhost上连接MemSQL,
mysql客户端可能仍然试着连接MySQL,http://docs.memsql.com/docs/memsql-faq#section-what-is-error-2002-which-appears-when-connecting-to-memsql-with-the-stock-mysql-client-using-default-arguments-
You may also use the –prompt flag to change the prompt in the
interactive session, simply to help distinguish MemSQL from MySQL:
Changing the prompt mysql -u root -h 127.0.0.1 -P 3306
–prompt=”memsql> ” The output when you connect should look similar to this: Connect SQL Welcome to the MySQL monitor. Commands end with ; or
\g. Your MySQL connection id is 6 Server version: 5.5.8 MemSQL source
distribution (compatible; MySQL Enterprise & MySQL Commercial)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights
reserved. Oracle is a registered trademark of Oracle Corporation
and/or its affiliates. Other names may be trademarks of their
respective owners. Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear
the current input statement. memsql>
你可能需要使用–prompt来改变交互式session的提示符,这样能把mysql和memsql区分开:
mysql -u root -h 127.0.0.1 -P 3306 –prompt=”memsql> ”
输出看起来大概是这样:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL
connection id is 6 Server version: 5.5.8 MemSQL source distribution
(compatible; MySQL Enterprise & MySQL Commercial) Copyright (c) 2000,
2015, Oracle and/or its affiliates. All rights reserved. Oracle is a
registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners. Type ‘help;’
or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
memsql>
These commands show more information about the connection and the
server:
下面的命令给出更多的信息
Additional information mysql> status
————– mysql Ver 14.14 Distrib 5.6.19, for osx10.9 (x86_64) using EditLine wrapper
Connection id: 6 Current database: Current user:
root@127.0.0.1 SSL: Not in use Current pager:
stdout Using outfile: ” Using delimiter: ; Server
version: 5.5.8 MemSQL source distribution (compatible; MySQL
Enterprise & MySQL Commercial) Protocol version: 10 Connection:
127.0.0.1 via TCP/IP Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 TCP port:
3306
mysql> show databases;+——————–+ | Database |
+——————–+ | information_schema | | memsql | | sharding |
+——————–+ 3 rows in set (0.00 sec)
mysql> show variables like ‘%version%’;
+————————-+——————————————————————————+ | Variable_name | Value
|
+————————-+——————————————————————————+ | memsql_version | 4.0
| | memsql_version_date | Wed May 6 09:07:03 2015 -0700
| | memsql_version_hash | 0cba132fba0ba7650c1bc9aeec8c1fc381def395
| | protocol_version | 10
| | version | 5.5.8
| | version_comment | MemSQL source distribution (compatible;
MySQL Enterprise & MySQL Commercial) | | version_compile_machine |
x86_64
| | version_compile_os | Linux
|
+————————-+——————————————————————————+ 8 rows in set (0.03 sec)
mysql> show status like ‘%license%’;
+—————+———————————-+ | Variable_name | Value |
+—————+———————————-+ | License_key | 5ca1ab1e000f40aaa6cb67b2ea3ee466 | | License_type | enterprise
|
+—————+———————————-+ 2 rows in set (0.00 sec)
mysql> show status like ‘%cluster_capacity%’;
+————————–+————-+ | Variable_name | Value |
+————————–+————-+ | Maximum_cluster_capacity | 10000000 MB | | Used_cluster_capacity | 107957 MB |
+————————–+————-+ 2 rows in set (0.00 sec)
The @@version and @@version_comment global variables are for
compatibility with MySQL clients, which expect certain minimum
version numbers and strings to be present. To check the real version
of MemSQL you are running, use the @@memsql_version variables
instead. To check the license you are running, see the license_key and
license_type status codes.
全局变量@@version和@@version_comment是为了和MySQL兼容,代表着当前最小的版本,为了得到你的真正的版本,使用@@memsql_version变量,为了
产看你正在运行的许可,看license_key和license_type。
Hibernate You will need JDBC in your classpath to connect to MemSQL.
Make sure you have Hibernate and Maven properly installed. Download
HibernateTutorial.zip. Unzip HibernateTutorial. Initialize your
database. Initialize the database CREATE DATABASE test; USE test;
CREATE TABLE USER (
-> USER_ID INT (5) NOT NULL,
-> USERNAME VARCHAR (20) NOT NULL,
-> CREATED_BY VARCHAR (20) NOT NULL,
-> CREATED_DATE DATE NOT NULL,
-> PRIMARY KEY ( USER_ID )
-> ); Edit HibernateTutorial/src/main/java/resources/hibernate.cfg.xml to match
your MemSQL configuration. For example our user is root with no
password. Our database is on localhost on port 3306. Hibernate
configuration
相关文章推荐
- Android之获取手机上的图片和视频缩略图thumbnails
- 数据库链接字符串查询网站
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- DB2实例管理
- DB2实例管理
- 保障MySQL数据安全的14个最佳方法
- mysql问答汇集
- 第三章 数据库备份和还原
- 创建一个空的IBM DB2 ECO数据库的方法
- Access 2000 数据库 80 万记录通用快速分页类
- 开通一个数据库失败的原因的和解决办法
- 一个简单的asp数据库操作类
- CentOS下DB2数据库安装过程详解
- EasyASP v1.5发布(包含数据库操作类,原clsDbCtrl.asp)第1/2页
- sql2008 还原数据库解决方案
- Oracle 数据库自动存储管理-安装配置
- Oracle数据库执行脚本常用命令小结
- Oracle 数据库 临时数据的处理方法
- 数据库分页查询语句数据库查询