Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL server shuts down unexpectedly-cannot start multiple instances

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Just now, the MySQL server accidentally lost power and shut down-after the device was started, no hardware error was reported and multiple instances could not be started.

[root@db02 ~] # mysql-uroot-S / data/3306/mysql.sock ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/ data/3306/mysql.sock' (111) # # cannot connect to the local mysql socket # #

View log: error is not recorded

Attempt to start mysql service failed

[root@db02 ~] # / data/3306/mysql startMySQL is running... [root@db02 ~] # ps-ef | grep msyql # but the mysql process did not start root 1327 1273 0 13:25 pts/0 00:00:00 grep-- color=auto msyql [root@db02 ~] #

Then I thought of the mysql startup principle, that is, I started the script through mysql, then called the mysqld_safe script, and finally called the MySQL main process, started the mysql service, and generated the socket file, so I went to the root directory to check and found that the service was not started but there was a socket file.

Repair mysql

[root@db02 3306] # ls / data/3306/data mysql mysql-bin.000002 mysql-bin.index mysql_oldboy3306.errmy.cnf mysql-bin.000001 mysql-bin.000003 mysqld.pid mysql.sock## suspected that the computer was shut down unexpectedly just now, and the msyql service was jammed, causing the sock file not to be removed, so consider renaming or moving the sock to / tmp [root@db02 3306] # cp / data/3306/mysql.sock {, .bak} # remove the sock file

Enable the MySQL service

[root@db02 3306] # / data/3306/mysql start # enable mysql service Starting MySQL... [root@db02 3306] # ps-ef | grep mysql # launch normal root 1363 10 13:31 pts/0 00:00:00 / bin/sh / application/mysql/bin/mysqld_safe-- defaults-file=/data/3306/my.cnfmysql 2087 1363 3 13:31 pts/0 00:00:00 / application/mysql-5.5.32 / bin/mysqld-- defaults-file=/data/3306/my.cnf-- basedir=/application/mysql-- datadir=/data/3306/data-- plugin-dir=/application/mysql/lib/plugin-- user=mysql-- open-files-limit=1024-- pid-file=/data/3306/mysqld.pid-- socket=/data/3306/mysql.sock-- port=3306root 2106 1273 0 13:31 pts/0 00:00:00 grep-- color=auto mysql

Enable multiple instances of MySQL

[root@db02 3306] # mysql-uroot-p-S / data/3306/mysql.sock Enter password: Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 2Server version: 5.5.32-log Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql >

That's it, back to normal.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report