[trouble shooting] 没关闭mysql服务器直接重启linux
问题情境
没有关闭mysqld服务器,直接重启linux,重启linux后报错
[root@localhost ~]# /usr/local/mysql/bin/mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
解决方案
重新启动MySQL服务器
[root@localhost ~]# /usr/local/mysql/bin/mysqld --user=mysql 151227 15:20:19 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.47) starting as process 2405 ... 151227 15:20:19 [Note] Plugin 'FEDERATED' is disabled. 151227 15:20:19 InnoDB: The InnoDB memory heap is disabled 151227 15:20:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins 151227 15:20:19 InnoDB: Compressed tables use zlib 1.2.3 151227 15:20:19 InnoDB: Using Linux native AIO 151227 15:20:19 InnoDB: Initializing buffer pool, size = 128.0M 151227 15:20:19 InnoDB: Completed initialization of buffer pool 151227 15:20:19 InnoDB: highest supported file format is Barracuda. 151227 15:20:20 InnoDB: Waiting for the background threads to start 151227 15:20:21 InnoDB: 5.5.47 started; log sequence number 17266717 151227 15:20:21 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 151227 15:20:21 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 151227 15:20:21 [Note] Server socket created on IP: '0.0.0.0'. 151227 15:20:21 [Note] Event Scheduler: Loaded 0 events 151227 15:20:21 [Note] /usr/local/mysql/bin/mysqld: ready for connections. Version: '5.5.47' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
[root@localhost data]# /usr/local/mysql/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.47 MySQL Community Server (GPL) Copyright (c) 2000, 2015, 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>