文前说明
作为码农中的一员,需要不断的学习,我工作之余将一些分析总结和学习笔记写成博客与大家一起交流,也希望采用这种方式记录自己的学习之旅。
本文仅供学习交流使用,侵权必删。
不用于商业目的,转载请注明出处。
Workench 是官发发布的 Mysql 客户端,下载地址:http://cdn.mysql.com//Downloads/MySQLGUITools/mysql-workbench-community-6.3.8-1.el7.x86_64.rpm
Workench 安装
rpm -ivh mysql-workbench-community-6.3.8-1.el7.x86_64.rpm
- 因为系统依赖不满足,给出提示信息
warning: mysql-workbench-community-6.3.8-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
tinyxml is needed by mysql-workbench-community-6.3.8-1.el7.x86_64
libzip is needed by mysql-workbench-community-6.3.8-1.el7.x86_64
python-paramiko >= 1.15.1 is needed by mysql-workbench-community-6.3.8-1.el7.x86_64
proj is needed by mysql-workbench-community-6.3.8-1.el7.x86_64
libodbc.so.2()(64bit) is needed by mysql-workbench-community-6.3.8-1.el7.x86_64
libodbcinst.so.2()(64bit) is needed by mysql-workbench-community-6.3.8-1.el7.x86_64
libpq.so.5()(64bit) is needed by mysql-workbench-community-6.3.8-1.el7.x86_64
- 配置中科大的 yum 源
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
- tinyxml 需要配置 EPEL 源
yum install epel-release.noarch
- 安装 tinyxml
yum install tinyxml
- 安装 libzip、python-paramiko、proj
yum install libzip python-paramiko proj.x86_64
- 安装 unixODBC 解决 libodbc.so.2 和 libodbcinst.so.2 依赖问题
yum install unixODBC
- libpq.so.5 需要下载 postgresql-libs-9.3.4-1.el7.x86_64.rpm 安装
rpm -ivh postgresql-libs-9.3.4-1.el7.x86_64.rpm
- 安装 Workench 成功
rpm -ivh mysql-workbench-community-6.3.8-1.el7.x86_64.rpm
- Workench 建表的基本字段类型标识
标识 | 名称 | 说明 |
---|---|---|
PK | primary key | 主键 |
NN | not null | 非空 |
UQ | unique | 唯一索引 |
BIN | binary | 二进制数据(比 text 更大) |
UN | unsigned | 无符号(非负数) |
ZF | zero fill | 填充 0,字段内容是 1 int(4),内容显示为0001。 |
AI | auto increment | 自增 |
G | Generated | 函数索引 |
- Generated 函数索引
Generated Column 是 MySQL 5.7 引入的新特性,这一列由其他列计算而得。例如:已知直角三角形的两条直角边,要求斜边的长度。斜边的长度可以通过两条直角边计算而得,在数据库中只存放直角边,斜边使用 Generated Column。Generated Column 分为 Virtual Column 和 Stored Column,默认为 Virtual Column,前者只将 Generated Column 保存在数据字典中(表的元数据),并不会将这一列数据持久化到磁盘上;后者会将 Generated Column 持久化到磁盘上,而不是每次读取的时候计算所得。后者存放了可以通过已有数据计算而得的数据,需要更多的磁盘空间。
-
Generated 函数索引的限制
- 不能给 virtual column 插入数据。
- 聚集索引不能包含 virtual column。
- 不能在 Virtual Column 上创建全文索引和空间索引。
- Virtual Column 不能作为外键。
- 创建 Generated Column (包括 Virtual Column 和 Stored Column)时不能使用非确定性的(不可重复的)函数。
- Generated Column 定义为 x列 / 0,插入数据报错(ERROR 1365 (22012): Division by 0)。
- Generated Column 定义为 x列 / y列,插入恶意数据,y列为 0,报错(ERROR 1365 (22012): Division by 0)。
- Generated Column 定义为 x列 / y列,删除源列 x 或 y,报错(ERROR 3108 (HY000): Column 'x' has a generated column dependency.)
网友评论