polardbx-sql
polardbx-sql copied to clipboard
mysql client occasionally encounters errors
mysql> show create table t1;
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| TABLE | CREATE TABLE |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t1 | CREATE TABLE `t1` (
`id` bigint(11) NOT NULL AUTO_INCREMENT,
`score` tinyint(4) NOT NULL,
`grade` tinyint(4) NOT NULL,
PRIMARY KEY (`id`),
KEY `ig` (`grade`)
) ENGINE = InnoDB AUTO_INCREMENT = 12 DEFAULT CHARSET = utf8
PARTITION BY KEY(`id`)
PARTITIONS 8 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> alter table t1 add age tinyint not null;
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
ERROR:
Can't connect to the server
mysql> alter table t1 add age tinyint not null;
No connection. Trying to reconnect...
Connection id: 3
Current database: d3
Query OK, 0 rows affected (3.63 sec)
how much rows has the Table ? And you can check the params as follows:
cat /proc/sys/net/ipv4/tcp_keepalive_time
cat /proc/sys/net/ipv4/tcp_keepalive_intvl
cat /proc/sys/net/ipv4/tcp_keepalive_probes
Maybe the tcp close the idle connection due to the ddl take long time.