Quantcast
Channel: mysql –开飞机的小蜗牛
Browsing latest articles
Browse All 13 View Live

Image may be NSFW.
Clik here to view.

MySQL JOIN 用法示例详解

本文将图文并茂的讲解 MySQL 的查询时 JOIN 的用法。这里用到的两个示例表及示例数据如下:CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, PRIMARY KEY (`id`),...

View Article



Image may be NSFW.
Clik here to view.

MySQL 建表出现 1064 错误

几乎没有手写过建表语句的人今天想建一个表将一个 csv 文件导入进行分析,SQL 写好了,运行出现错误码 1064, 但是没有文字描述错在哪里,为了分析错误原因,将字段改为最简单的形式,还是出错:create table table_name ( id unsigned int not null auto_increment, name varchar(20), primary key (id) )...

View Article

Image may be NSFW.
Clik here to view.

MySQL ERROR: DELAYED option not supported for table

出现这个错误是因为存储引擎 innoDB 不支持 delayed 操作,请检查表类型,更改为 MyISAM。详 ...Continue reading ‘MySQL ERROR: DELAYED option not supported for table’ » 您可能也喜欢: MySQL JOIN 用法示例详解 MySQL MySQL 去除换行和回车符 MySQL 建表出现 1064 错误...

View Article

Image may be NSFW.
Clik here to view.

MySQL 整数类型指定宽度

MySQL 中可以为整数类型指定宽度,例如有如下表:CREATE TABLE `tmp01160800` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `is_enable` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `is_enable`...

View Article

Image may be NSFW.
Clik here to view.

分享一个 MySQL 分库分表类

当一个表数据记录过大时就会出现性能瓶颈,而一般对应的解决办法是要么做分区表,要么分表,分区表就不说了,分表又分为垂直分割和水平分割,具体区别请自行搜索。一般而言,分库分表属于水平分割,按照一定的规则将数据插入到不同的表中去。而分库则可以很方便的转移数据库的压力,比如将一个很大库的分别放在不同的服务器上。 下面是我写的一个分库分表的实现:<?php /** * User: jing.liu *...

View Article


Image may be NSFW.
Clik here to view.

MySQL 去除换行和回车符

UPDATE tablename SET field = REPLACE(REPLACE(field, CHAR(10), ''), CHAR(13), '');char(10):  换行符char(13):  回车符 参考:http://www.gowhich.com/blog/446 您可能也喜欢: MySQL 建表出现 1064 错误 MySQL 整数类型指定宽度 MySQL MySQL...

View Article

Image may be NSFW.
Clik here to view.

MySQL 配置最基础的主从

Basic Steps in Replication This chapter will introduce several sophisticated techniques for maximizing the effi‐ ciency and value of replication, but as a first step, we will set up the simple...

View Article

Incorrect key file for table ‘xxx’; try to repair it

2017-04-21 01:29:34 7f1d8c0bd700 InnoDB: Error: Write to file (merge) failed at offset 2095054848. InnoDB: 1048576 bytes should have been written, only 978944 were written. InnoDB: Operating system...

View Article


Optimizing Storage Layout for InnoDB Tables

OPTIMIZE TABLE 主键尽可能短 VARCHAR 代替 CHAR 大表或包含大量重复字符或数值数据,使用 COMPRESSED 行格式 https://dev.mysql.com/doc/refman/5.6/en/optimizing-innodb-storage-layout.html

View Article


MyISAM 和 InnoDB 存储引擎区别及各自使用场景

InnoDB 主要优势 事务支持:事务提交回滚以及错误恢复。 行级锁 聚合索引 外键支持 InnoDB 在 MySQL 5.6.4 后支持全文索引。 MySQL 5.5 后默认存储引擎为InnoDb。 如果不能使用到索引,行级锁会失效。 如何选择两种存储引擎 大量读,几乎没有写请求 和 小于5.6.4版本需要全文索引,选择 MyISAM,其他情况选择InnoDB。 我的性能测试结果,仅供参考...

View Article
Browsing latest articles
Browse All 13 View Live




Latest Images