mysql版本:5.7.23
在内网的服务器上安装都没问题,但在公司买的阿里云ECS安装,就遇到这样的问题,我也没搞懂!
问题描述:
安装好后,把mysql跑起来后,命令行登录mysql提示Segmentation fault
[root@izwz9i9xmvw9w1xko4wkriz ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23 Source distribution
Copyright (c) 2000, 2018, 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.
Segmentation fault
[root@izwz9i9xmvw9w1xko4wkriz ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.23 Source distribution
Copyright (c) 2000, 2018, 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.
Segmentation fault
[root@izwz9i9xmvw9w1xko4wkriz ~]#
查看错误日志,是这样的:
[Note] Aborted connection 2 to db: 'unconnected' user: 'root' host: '' (Got an error reading communication packets)
百度,Google了好长时间,一直搜Got an error reading communication packets,人家说要么是网络问题,要么是系统时间,要么是mysql max_allowed_packet设得太小,还有就是要么是wait_timeout等等,所有这些都试了个遍,都没解决问题,忽略了控制台有个Segmentation fault出错提示。
==========解决方法1============
在源码包里,编辑文件 cmd-line-utils/libedit/terminal.c
把terminal_set方法中的 char buf[TC_BUFSIZE]; 这一行注释,再把 area = buf;改为 area = NULL;
更改后如下
/* terminal_set():
* Read in the terminal capabilities from the requested terminal
*/
protected int
terminal_set(EditLine *el, const char *term)
{
int i;
char buf[TC_BUFSIZE];
char *area;
const struct termcapstr *t;
sigset_t oset, nset;
int lins, cols;
(void) sigemptyset(&nset);
(void) sigaddset(&nset, SIGWINCH);
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
//area = buf;
area = NULL;
if (term == NULL)
term = getenv("TERM");
注意是area = buf;那一行。
改好后,重新编译安装。
最后,终于进入了
[root@izwz9i9xmvw9w1xko4wkriz ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.23 Source distribution
Copyright (c) 2000, 2018, 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.
Segmentation fault
[root@izwz9i9xmvw9w1xko4wkriz ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23 Source distribution
Copyright (c) 2000, 2018, 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.
mysql>
网友评论