Skip to content

Instantly share code, notes, and snippets.

@morgo
morgo / gist:779e0c9d8701a5141553
Created January 29, 2015 16:50
5.7 OR example
mysql [localhost] {msandbox} (test) > SELECT version();
+---------------+
| version() |
+---------------+
| 5.7.5-m15-log |
+---------------+
1 row in set (0.00 sec)
mysql [localhost] {msandbox} (test) > SHOW VARIABLES LIKE 'sql_mode';
+---------------+---------------------------------------------------------------+
@morgo
morgo / SHOW PROCESSLIST in 5.7
Created September 12, 2015 01:17
SHOW PROCESSLIST in 5.7
# works in all versions
mysql> SHOW PROCESSLIST;
+----+----------+-----------+------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+----------+-----------+------+---------+------+----------+------------------+
| 3 | msandbox | localhost | NULL | Query | 0 | starting | SHOW PROCESSLIST |
+----+----------+-----------+------+---------+------+----------+------------------+
1 row in set (0.00 sec)
# using SYS (ships with MySQL 5.7)
@morgo
morgo / keybase.md
Created September 23, 2015 15:26
keybase.md

Keybase proof

I hereby claim:

  • I am morgo on github.
  • I am morgo (https://keybase.io/morgo) on keybase.
  • I have a public key whose fingerprint is BEAF CAD6 3F51 DF9A 1915 0356 6B38 6951 7695 2538

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am morgo on github.
  • I am morgo (https://keybase.io/morgo) on keybase.
  • I have a public key whose fingerprint is 97A4 2DBE 3564 9BE6 0B37 E35C C00C 8FB5 BF35 ACE4

To claim this, I am signing this object:

create table department (
id bigint not null,
budget bigint not null,
name varchar(255),
primary key (id)
) ENGINE=InnoDB;
create table employee (
# Initial Data does not make sense
# should be either "Harvey Dent" or "Two Face"
id: 1, firstname: "Two Face", lastname: "Dent"
# Assume RR isolation
session1.start
session2.start
morgo@ryzen:~/go/src/github.com/pingcap/tidb$ git diff
diff --git a/util/charset/charset_test.go b/util/charset/charset_test.go
index c400d97f..931b78ac 100644
--- a/util/charset/charset_test.go
+++ b/util/charset/charset_test.go
@@ -17,6 +17,8 @@ import (
"testing"
. "github.com/pingcap/check"
+ "github.com/pingcap/tidb/store/mockstore"
@morgo
morgo / mydumper-test-case
Created October 10, 2018 14:20
mydumper-test-case
MySQL [test]> create table t1 (a int not null primary key auto_increment, b char(255));
Query OK, 0 rows affected (0.51 sec)
MySQL [test]> create table t2 (a char(255) not null primary key, b char(255));
Query OK, 0 rows affected (0.51 sec)
MySQL [test]> INSERT INTO t1 values (1, 'aaa');
Query OK, 1 row affected (0.15 sec)
MySQL [test]> INSERT INTO t2 values ('aaa', 'aaa');
@morgo
morgo / dm-sandbox-mysql-to-tidb.sh
Created February 25, 2019 19:18
Setup DM between MySQL 5.7 and TiDB Sandboxes
#!/bin/bash
killall -9 dm-master
killall -9 dm-worker
# Setup DM between sandboxes
MYSQL_PORT="5725"
TIDB_PORT="3000"
echo "Downloading required packages"
#!/bin/bash
source ./sb_include
# Setup DM between sandboxes
SOURCE=$1
if [ -z "$SOURCE" ]; then
echo "Usage: "