Mysqlcheck got error 2013 lost connection to mysql server during query when executing check table

I just upgraded Ubuntu from 11.10 to 12.04. My rails app now returns the (passenger) error "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) (Mysql2::Error)". ...

I just upgraded Ubuntu from 11.10 to 12.04. My rails app now returns the (passenger) error «Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111) (Mysql2::Error)». I get a similar error when I try to access mysql at the command line on my Ubuntu server using mysql -u root -p.

I have mysql-server 5.5 installed. I’ve checked and mysql is not running. When I try to restart it, it fails.

Here are some key lines from the tail of /var/log/syslog after an attempted restart:

dean@dgwjasonfried:/etc/mysql$ tail -f /var/log/syslog
Mar  7 08:55:27 dgwjasonfried /etc/mysql/debian-start[5107]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Mar  7 08:55:27 dgwjasonfried /etc/mysql/debian-start[5107]: Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' '--host=localhost' '--socket=/var/run/mysqld/mysqld.sock' '--host=localhost' '--socket=/var/run/mysqld/mysqld.sock' 
Mar  7 08:55:27 dgwjasonfried /etc/mysql/debian-start[5107]: Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' '--host=localhost' '--socket=/var/run/mysqld/mysqld.sock' '--host=localhost' '--socket=/var/run/mysqld/mysqld.sock' 
Mar  7 08:55:27 dgwjasonfried /etc/mysql/debian-start[5107]: /usr/bin/mysqlcheck: Got error: 2013: Lost connection to MySQL server during query when executing 'CHECK TABLE ...  FOR UPGRADE'
Mar  7 08:55:27 dgwjasonfried /etc/mysql/debian-start[5107]: FATAL ERROR: Upgrade failed
Mar  7 08:55:27 dgwjasonfried /etc/mysql/debian-start[5107]: molex_app_development.assets                       OK
Mar  7 08:55:27 dgwjasonfried /etc/mysql/debian-start[5107]: molex_app_development.ecd_types                    OK
Mar  7 08:55:27 dgwjasonfried /etc/mysql/debian-start[5124]: Checking for insecure root accounts.
Mar  7 08:55:27 dgwjasonfried kernel: [ 7551.769657] init: mysql main process (5064) terminated with status 1
Mar  7 08:55:27 dgwjasonfried kernel: [ 7551.769697] init: mysql respawning too fast, stopped

Here is most of /etc/mysql/my.cnf:

Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

Here is entries for some specific programs
The following values assume you have at least 32M ram

This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]

  Basic Settings

user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

 Instead of skip-networking the default is now to listen only on
 localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

And here are permissions for var/run/mysqld/mysqld.sock:

srwxrwxrwx 1 mysql mysql 0 Mar 7 09:18 mysqld.sock

I’d be grateful for any suggestions the community might have. I reviewed the related questions here and attempted some of the fixes offered but to no avail.

Thanks!

Dean Richardson

Update:

Thanks to quanta’s suggestion, I looked at the /var/log/mysql/error.log file. I found error messages relating to pointers, fatal signals, and more stuff that I really couldn’t make much sense of. I also found mysql man page references, however. One suggested that I try starting mysqld with the —innodb_force_recovery=# option, then attempt to dump (or drop) the offending/corrupted database or table.

I worked through the escalating option levels one-by-one (innodb_force_recovery=1, innodb_force_recovery=2, etc.) This allowed me to successfully run mysql -u root -p from the command line and execute several commands. I was able to run queries on my production database, but any attempt to query, dump, or even drop my development database raised an error and led to me losing the connection to mysql.

So I’ve made progress, but until I’m somehow able to drop or repair my development db I’m still unable to get my app to load.

Any further advice or suggestions?

Thanks!

Dean

Update:

Right after running sudo mysqld —innodb_force_recover=1 from the command line, the error.log contains this:

Right after retrying sudo mysqld —innodb_force_recover=1, The error.log file shows this:

130308  4:55:39 [Note] Plugin 'FEDERATED' is disabled.
130308  4:55:39 InnoDB: The InnoDB memory heap is disabled
130308  4:55:39 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130308  4:55:39 InnoDB: Compressed tables use zlib 1.2.3.4
130308  4:55:39 InnoDB: Initializing buffer pool, size = 128.0M
130308  4:55:39 InnoDB: Completed initialization of buffer pool
130308  4:55:39 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130308  4:55:39  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
130308  4:55:40  InnoDB: Waiting for the background threads to start
130308  4:55:41 InnoDB: 1.1.8 started; log sequence number 10259220
130308  4:55:41 InnoDB: !!! innodb_force_recovery is set to 1 !!!
130308  4:55:41 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
130308  4:55:41 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
130308  4:55:41 [Note] Server socket created on IP: '127.0.0.1'.
130308  4:55:41 [Note] Event Scheduler: Loaded 0 events
130308  4:55:41 [Note] mysqld: ready for connections.
Version: '5.5.29-0ubuntu0.12.04.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

Then after mysql -u root -p and

mysql> drop database molex_app_development;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 

the error.log contains:

dean@dgwjasonfried:/var/log/mysql$ tail -f error.log
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f6a3ff9ecbd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f6a1c004bd8): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
130308  4:55:39 [Note] Plugin 'FEDERATED' is disabled.
130308  4:55:39 InnoDB: The InnoDB memory heap is disabled
130308  4:55:39 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130308  4:55:39 InnoDB: Compressed tables use zlib 1.2.3.4
130308  4:55:39 InnoDB: Initializing buffer pool, size = 128.0M
130308  4:55:39 InnoDB: Completed initialization of buffer pool
130308  4:55:39 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130308  4:55:39  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
130308  4:55:40  InnoDB: Waiting for the background threads to start
130308  4:55:41 InnoDB: 1.1.8 started; log sequence number 10259220
130308  4:55:41 InnoDB: !!! innodb_force_recovery is set to 1 !!!
130308  4:55:41 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
130308  4:55:41 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
130308  4:55:41 [Note] Server socket created on IP: '127.0.0.1'.
130308  4:55:41 [Note] Event Scheduler: Loaded 0 events
130308  4:55:41 [Note] mysqld: ready for connections.
Version: '5.5.29-0ubuntu0.12.04.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
130308  4:58:23 [ERROR] Incorrect definition of table mysql.proc: expected column 'comment' at position 15 to have type text, found type char(64).
130308  4:58:23  InnoDB: Assertion failure in thread 140168992810752 in file fsp0fsp.c line 3639
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
10:58:23 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346681 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f7ba4f6c2f0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f7ba3065e60 thread_stack 0x30000
mysqld(my_print_stacktrace+0x29)[0x7f7ba3609039]
mysqld(handle_fatal_signal+0x483)[0x7f7ba34cf9c3]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f7ba2220cb0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7f7ba188c425]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x17b)[0x7f7ba188fb8b]
mysqld(+0x65e0fc)[0x7f7ba37160fc]
mysqld(+0x602be6)[0x7f7ba36babe6]
mysqld(+0x635006)[0x7f7ba36ed006]
mysqld(+0x5d7072)[0x7f7ba368f072]
mysqld(+0x5d7b9c)[0x7f7ba368fb9c]
mysqld(+0x6a3348)[0x7f7ba375b348]
mysqld(+0x6a3887)[0x7f7ba375b887]
mysqld(+0x5c6a86)[0x7f7ba367ea86]
mysqld(+0x5ae3a7)[0x7f7ba36663a7]
mysqld(_Z15ha_delete_tableP3THDP10handlertonPKcS4_S4_b+0x16d)[0x7f7ba34d3ffd]
mysqld(_Z23mysql_rm_table_no_locksP3THDP10TABLE_LISTbbbb+0x568)[0x7f7ba3417f78]
mysqld(_Z11mysql_rm_dbP3THDPcbb+0x8aa)[0x7f7ba339780a]
mysqld(_Z21mysql_execute_commandP3THD+0x394c)[0x7f7ba33b886c]
mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x10f)[0x7f7ba33bb28f]
mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1380)[0x7f7ba33bc6e0]
mysqld(_Z24do_handle_one_connectionP3THD+0x1bd)[0x7f7ba346119d]
mysqld(handle_one_connection+0x50)[0x7f7ba3461200]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a)[0x7f7ba2218e9a]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f7ba1949cbd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f7b7c004b60): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

—Dean

  • Печать

Страницы: [1]   Вниз

Тема: не стартует mysql  (Прочитано 3535 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
DimmKo

Добрый день.
Случилась неприятность: не стартует mysql. Ubuntu (x86_64) 14.04.4 LTS.
Всё было нормально, провел обновление apt-get update && apt-get upgrade (mysql не обновлялся), всё прошло штатно без ошибок, перезапустил сервер.
При загрузке написал, что starting mysql — failed.
Запускаю руками и вижу вот такое дело:

и ничего не происходит. Нажимаю CTRL + C, делаю service mysql start —> OK | service mysql status mysql start/running, process 29726
далее, хочу сделать дамп БД, на что получаю вот такую ошибку:

Попробовал поиска в гугле ошибку, но что нашел не подходит. Не могу понять в чем дело.
Логи:
1) /var/log/mysql/error

2) /var/log/syslog

Может дополнительно какие-то логи надо добавить.

Может кто знает, что я упустил из виду, для решения это проблемы?
Спасибо.

Ubuntu Server 20.04.2 LTS | x86_64


Оффлайн
lAionl

Бегло ознакомившись с текстом:

Checking for tables which need an upgrade, are corrupt or were
not closed cleanly.

могу сказать, что нужно чинить ^_^:

mysqlcheck --check-upgrade --all-databases --auto-repair -u root -p
mysql_upgrade --force -u root -p
P.S. если пока я иду разогревать обед, вы воспользовавшись этими командами убьете содержимое БД, я снимаю с себя ответственность за это. Перед вводом команд, убедитесь что имеется резервная копия данных.

« Последнее редактирование: 11 Марта 2016, 11:01:24 от lAionl »

Asus K53SV,i7-2670QM,16Gb RAM, GT540M, 3.18.11-gentoo.


Оффлайн
DimmKo

lAionl,
добрый день, спасибо за ваш совет, но что-то пошло не так ^_^
Enter password:
mysqlcheck: Got error: 1049: Unknown database ‘—check-upgrade’ when selecting the database

Ubuntu Server 20.04.2 LTS | x86_64


Оффлайн
lAionl

Исправил команды в ответе выше, попробуйте.

Asus K53SV,i7-2670QM,16Gb RAM, GT540M, 3.18.11-gentoo.


Оффлайн
DimmKo

lAionl,
благодарю…
1) команду запустил… появилось много «ОК», а закончилось вот этим
mysqlcheck: Got error: 2013: Lost connection to MySQL server during query when executing ‘CHECK TABLE …  FOR UPGRADE’

вторую команду стоит ли запускать?

Ubuntu Server 20.04.2 LTS | x86_64


Оффлайн
lAionl

Попробуйте.

mysqlcheck --all-databases --repair --analyze --optimize --auto-repair

Asus K53SV,i7-2670QM,16Gb RAM, GT540M, 3.18.11-gentoo.


Оффлайн
DimmKo

Попробуйте.
mysqlcheck --all-databases --repair --analyze --optimize --auto-repair

Error:  mysqlcheck doesn’t support multiple contradicting commands.

Ubuntu Server 20.04.2 LTS | x86_64


Оффлайн
lAionl

mysqlcheck --all-databases --repair --analyze --optimize

Asus K53SV,i7-2670QM,16Gb RAM, GT540M, 3.18.11-gentoo.


Оффлайн
DimmKo

lAionl,
та же ошибка
попробовал вот это

mysqlcheck --all-databases --optimize --auto-repair -u root -pвыдало значения по одной базе

и закончилось вот этим
mysqlcheck: Got error: 2013: Lost connection to MySQL server during query when executing ‘OPTIMIZE TABLE … ‘

может удалить эту базу?

Ubuntu Server 20.04.2 LTS | x86_64


Оффлайн
lAionl

нужно запустить  mysql и передать как параметр —net_read_timeout=6000, затем повторить самую первую команду которую вводили (самый первый ответ)

Asus K53SV,i7-2670QM,16Gb RAM, GT540M, 3.18.11-gentoo.


Оффлайн
DimmKo

нужно запустить  mysql и передать как параметр —net_read_timeout=6000, затем повторить самую первую команду которую вводили (самый первый ответ)

сделал /etc/init.d/mysql start —net_read_timeout=6000
запустился так же с кучей ошибок.
Выполнил команду из вашего 1-го ответа:
mysqlcheck: Got error: 2013: Lost connection to MySQL server during query when executing ‘CHECK TABLE …  FOR UPGRADE’

Может удалить нафиг, да и заново поставить?

Ubuntu Server 20.04.2 LTS | x86_64


Оффлайн
lAionl

Может удалить нафиг, да и заново поставить?

Можно попробовать.

Asus K53SV,i7-2670QM,16Gb RAM, GT540M, 3.18.11-gentoo.


Оффлайн
DimmKo

lAionl,
спасибо за вашу помощь.

Решение:
удалил (правда через webmin) всё что связано с mysql:

потом папки удалил (/etc/mysql | /var/lib/mysql)
потом перезагрузился и заново установил.
Залил дампы баз обратно — всё корректно работает.

Ubuntu Server 20.04.2 LTS | x86_64


  • Печать

Страницы: [1]   Вверх

If you spend time running lots of MySQL queries, you might come across the Error Code: 2013. Lost connection to MySQL server during query. This article offers some suggestions on how to avoid or fix the problem.

Why this happens

This error appears when the connection between your MySQL client and database server times out. Essentially, it took too long for the query to return data so the connection gets dropped.

Most of my work involves content migrations. These projects usually involve running complex MySQL queries that take a long time to complete. I’ve found the WordPress wp_postmeta table especially troublesome because a site with tens of thousands of posts can easily have several hundred thousand postmeta entries. Joins of large datasets from these types of tables can be especially intensive.

Avoid the problem by refining your queries

In many cases, you can avoid the problem entirely by refining your SQL queries. For example, instead of joining all the contents of two very large tables, try filtering out the records you don’t need. Where possible, try reducing the number of joins in a single query. This should have the added benefit of making your query easier to read. For my purposes, I’ve found that denormalizing content into working tables can improve the read performance. This avoids time-outs.

Re-writing the queries isn’t always option so you can try the following server-side and client-side workarounds.

Server-side solution

If you’re an administrator for your MySQL server, try changing some values. The MySQL documentation suggests increasing the net_read_timeout or connect_timeout values on the server.

Client-side solution

You can increase your MySQL client’s timeout values if you don’t have administrator access to the MySQL server.

MySQL Workbench

You can edit the SQL Editor preferences in MySQL Workbench:

  1. In the application menu, select Edit > Preferences > SQL Editor.
  2. Look for the MySQL Session section and increase the DBMS connection read time out value.
  3. Save the settings, quite MySQL Workbench and reopen the connection.

Navicat

How to edit Navicat preferences:

  1. Control-click on a connection item and select Connection Properties > Edit Connection.
  2. Select the Advanced tab and increase the Socket Timeout value.

Command line

On the command line, use the connect_timeout variable.

Python script

If you’re running a query from a Python script, use the connection argument:
con.query('SET GLOBAL connect_timeout=6000')

The misstep depicted in the title of this article is entirely outstanding. A couple of attempts on handling the issue exist in various articles on the web. However, in error 2013 you lost connection to MySQL server during a query, concerning this article, there is a specific condition that is exceptionally novel so in the end, it causes the error to occur. The error occurs with the specific error message. That error message is in the going with yield message:


  • root@hostname ~# mysql – uroot – p – h 127.0.0.1 – P 4406
  • Enter secret key:
  • Error 2013 (HY000): Lost relationship with MySQL server at ‘examining initial correspondence bundle’, system error: 0
  • root@hostname ~#

The above error message is a result of partner with a MySQL Database Server. It is a standard MySQL Database Server running on a machine. However, the real connection is a substitute one. The connection exists using Worker holder running collaboration. Coming up next is the reliable running course of that Worker holder:


  • root@hostname ~# netstat – tulpn | grep 4406
  • tcp6 0:4406: * LISTEN 31814/worker-go-between
  • root@hostname ~#

There are at this point lots of articles analyze about this mix-up. For a model in this association in the stack overflow or this association and one more in this association, besides in this association. The general issue is truly something almost identical. There is something misguided in the running arrangement of the regular MySQL Database Server.

Why this happens

This misstep appears when the relationship between your MySQL client and database server times out. Essentially, it took unreasonably long for the request to return data so the connection gets dropped.

By far most of my work incorporates content migrations. These activities for the most part incorporate running complex MySQL requests that burn through a huge lump of the day to wrap up. I’ve found the WordPress wp_postmeta table especially hazardous considering the way that a site with countless posts can without a very remarkable stretch have two or three hundred thousand post meta sections. Joins of enormous datasets from such tables can be especially genuine.

Avoid the issue by sanitizing your requests

Generally speaking, you can avoid the issue absolutely by refining your SQL questions. For example, instead of joining all of the substance of two especially immense tables, have a go at filtering through the records you needn’t waste time with. Where possible, have a go at reducing the amount of partakes in a singular inquiry. This should have the extra benefit of simplifying your inquiry to examine. For my inspirations, I’ve found that denormalizing content into working tables can deal with the read execution. This avoids breaks.

Re-making the inquiries isn’t, by and large, another option so you can effort the going with server-side and client-side workarounds.

A server-side course of action

If you’re ahead for your MySQL server, make a pass at changing a couple of characteristics. The MySQL documentation proposes extending the net_read_timeout or connect timeout values on the server.

The client-side course of action

You can extend your MySQL client’s sever regards on the possibility that you don’t have exclusive induction to the MySQL server.

MySQL Worktable

You can adjust the SQL Editor tendencies in MySQL Work Table:

  • In the application menu, select Edit > Preferences > SQL Editor.
  • Quest for the MySQL Session portion and augmentation the DBMS connection read break regard.
  • Save the settings, very MySQL Work Table, and return the connection.

Step for handling the issue

There are a couple of stages for handling the issue above. There are two segments for handling the issue. The underlying portion is for perceiving the principal driver of the issue. Later on, the ensuing part is the genuine plan taken for tending to the fundamental driver of that issue. Thusly, going with the region which is the underlying portion will focus on power to search for the justification behind the issue.

Glancing through the justification behind the issue

Because of this article, coming up next is the means for settling the mix-up

  1. Check whether the MySQL Database Server measure is truly running. Effect it as follows using any request plan open in the working for truly taking a gander at a running connection. Concerning this article, it is ‘systemctl status MySQL. Thusly, coming up next is a model for the execution of the request plan:

  • root@hostname ~# systemctl status MySQL
  • service – MySQL Community Server
  • Stacked: stacked (/lib/systemd/structure/mysql.service; horrible; vendor preset: engaged)
  • Dynamic: dynamic (running) since Mon 2019-09-16 13:16:12; 40s back
  • Cycle: 14867 ExecStart=/usr/sbin/mysqld – demonize – pid-file=/run/mysqld/mysqld. Pid (code=exited, status=0/SUCCESS)
  • Connection: 14804 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
  • Guideline PID: 14869 (mysqld)
  • Tasks: 31 (limit: 4915)
  • Group:/system. Slice/mysql.service
  • └─14869/usr/sbin/mysqld – daemonize – pid-file=/run/mysqld/mysqld. Pid
  • root@hostname ~#

  1. Preceding partner with MySQL Database Server using a substitute port focusing on any moving toward requesting where it is a worker compartment measure dealing with, basically test the regular connection. By the day’s end, the partner using the normal port tuning in the machine for any moving toward a relationship with MySQL Database Server. Normally, it exists in port ‘3306’. Do it as follow:

  • root@hostname ~# mysql – uroot
  • Goof 2002 (HY000): Can’t interface with neighborhood MySQL server through connection ‘/var/run/mysqld/mysqld. Sock’ (2)
  • root@hostname ~#

The above screw-up message is where the genuine root issue is. Check for the genuine report which is tending to the connection record for MySQL daemon measure as follows:


  • root@hostname ~# disc/var/run/mysqld/
  • root@hostname ~# ls
  • Pid MySQL. sock MySQL. sock. Lock
  • root@hostname ~#

As shown by the above yield, the report doesn’t exist. That is the explanation the relationship with MySQL Database Server is continually failed. Even though the connection cooperation is done through the default port of ‘3306’.

  1. The effort to restart the cooperation and trust that it will handle the issue.

  • root@hostname ~# systemctl stop MySQL
  • root@hostname ~# systemctl start MySQL
  • root@hostname ~# mysql – uroot
  • Slip-up 2002 (HY000): Can’t interface with neighborhood MySQL server through connection ‘/var/run/mysqld/mysqld. Sock’ (2)
  • root@hostname ~#

  1. Unfortunately, the above cycle moreover wraps up in disappointment. Progress forward the movement for handling the issue, just check the MySQL Database arrangement record. In the wake of really investigating the report course of action, it doesn’t fit in any way shape, or form. Eventually, going through hours for changing the arrangement records, nothing happens.

For the reason happens above, check the right game plan before to see which MySQL Database Server arrangement is used by the running MySQL Database Server.

How might we fix MySQL Error 2013 (hy000)?

The fix for MySQL Error 2013 (hy000) depends a ton upon the setting off reason. We should now see how our MySQL Engineers help customers with settling it.

1. Changing MySQL limits

Lately, one of our customers pushed toward us saying that he is getting a mix-up as the one showed underneath while he is efforting to interface with the MySQL server.

Along these lines, our Engineers checked thoroughly and found that the connect timeout regard was set to two or three minutes. Thusly, we extended it to 10 in the MySQL arrangement record. For that, we followed the means underneath:

First thing, we opened the MySQL plan archive at, etc/MySQL/my.cnf

Then, we searched for connect timeout and set it as:

  • connect timeout=10

Then, we had a go at partner with MySQL server and we were viable.

Additionally, it requires the genuine setting of the variable max_allowed_packet in the MySQL arrangement record also. While efforting to restore the landfill record in GB sizes, we increase the value to a higher one.

2. Disabled person Access limits

This slip-up in like manner appears when the host approaches impediments. In such cases, we fix this by adding the client’s IP in, etc/hosts. Allow or license it in the server firewall.

Similarly, the error can happen as a result of the detachment of the server. Lately, in a similar case, the issue was not related to MySQL server or MySQL settings. We did a significant tunnel and found that high association traffic is causing the issue.

Exactly when we checked we found that an unconventional communication running by the Apache customer. Thusly, we killed that, and this good misstep.

3. Growing Server Memory

Last and not least, MySQL memory apportioning furthermore transforms into a basic factor for the slip-up. Here, the server logs will have related segments showing the lacking memory limit.

Subsequently, our Dedicated Engineers decline the innodb_buffer_pool size. This reduces the memory segment on the server and fixes the slip-up.

Checking the MySQL Database Server configuration used by the running MySQL Database Server

In the past fragment or part, there is a need to search for the real plan report used by the running MySQL Database Server. It is essential to guarantee that the plan record used is the right one. Thusly, every change can invite the right impact on dealing with the mix-up issue. Coming up next is the movement for searching for it:

  1. Truly check out the once-over of the assistance first by suggesting the running framework. In the past part, the running framework is the ‘MySQL one. Execute the going with request guide to list the open running cycle:
  • systemctl list-unit-reports | grep MySQL

The yield of the above request plan for a model is in the going with one:


  • user hostname: ~$ systemctl list-unit-archives | grep MySQL
  • service horrendous
  • Service horrendous
  • user hostname: ~$

  1. Then, at that point, truly investigate the substance of the help by executing the going with the request. Pick the right help, in this particular circumstance, it is ‘MySQL. service’:

  • user hostname: ~$ systemctl cat myself. service
  • #/lib/system/structure/Mysql.service
  • # MySQL systemd organization record
  • [Unit]
  • Description=MySQL Community Server
  • After=network. Target
  • [Install]
  • Wanted by=multi-user. Target
  • [Service]
  • Type=forking
  • User=mysql
  • Group=mysql
  • PIDFile=/run/mysqld/mysqld. Pid
  • PermissionsStartOnly=true
  • ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
  • ExecStart=/usr/sbin/mysqld – daemonize – pid-file=/run/mysqld/mysqld. Pid
  • Timeouts=600
  • Restart=on-dissatisfaction
  • Runtime Directory=mysqld
  • RuntimeDirectoryMode=755
  • LimitNOFILE=5000
  • user hostname: ~$

  1. The record obligated for starting the help is in the archive ‘/usr/share/MySQL/MySQL-systems-start’ according to the yield message above. Coming up next is the substance of that record which is only fundamental for it:

  • if [! – r, etc/MySQL/my.cnf]; then,
  • resonation “MySQL arrangement not found at, etc/MySQL/my.in. Assuming no one minds, make one.”
  • leave 1
  • fi
  • …..

  1. Resulting in truly taking a gander at the substance of the report ‘/, etc/MySQL/my.on, obviously, it isn’t the right record. Accordingly, to be more exact, there are other ways to deal with find the planned archive used by the running MySQL Database Server. The reference or the information exists in this association. Hence, according to the information in that association, basically perform the going with request guide to get the right one. It is forgetting the cycle ID and the right MySQL Database Server running collaboration:

  • root@hostname ~# netstat – tulpn | grep 3306
  • tcp6 0:3306: * LISTEN 21192/mysqld
  • root@hostname ~# ps aux | grep 21192
  • root@hostname ~# ps aux | grep 21192
  • mysql 21192 0.2 0.1 3031128 22664? Sl Sep16 1:39/usr/sbin/mysqld – daemonize – pid-file=/run/mysqld/mysqld. Pid
  • root 25442 0.0 23960 1068 pts/20 S+ 01:41 0:00 grep 21192
  • root@hostname ~#
  • Ensuing to getting the right running cycle, do the going with the request of ‘trace file_name_process’:
  • root@hostname ~# album/usr/bin/
  • root@hostname ~# strace. /mysqld
  • Coming up next is fundamental for the yield of the request:
  • detail, etc/my.cnf”, 0x7fff2e917880) = – 1 ENOENT (No such archive or vault)
  • detail, etc/mysql/my.cnf”, {st_mode=S_IFREG|0644, st_size=839, …}) = 0
  • openat (AT_FDCWD, “/, etc/mysql/my.cnf”, O_RDONLY) = 3
  • fstat (3, {st_mode=S_IFREG|0644, st_size=839, …}) = 0
  • brk(0x35f6000) = 0x35f6000
  • read (3, “#n# The MySQL data base server co”…, 4096) = 839
  • openat (AT_FDCWD, “/, etc/mysql/conf. d/”, O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
  • fstat (4, {st_mode=S_IFDIR|0755, st_size=4096, …}) = 0
  • get dents (4, /* 4 entries */, 32768) = 120
  • get dents (4, /* 0 entries */, 32768) = 0
  • close (4) = 0
  • detail, etc/mysql/conf.d/mysql.cnf”, {st_mode=S_IFREG|0644, st_size=629, …}) = 0
  • openat (AT_FDCWD, “/, etc/mysql/conf.d/mysql.cnf”, O_RDONLY) = 4
  • fstat (4, {st_mode=S_IFREG|0644, st_size=629, …}) = 0
  • read (4, “[mysqld]nn# Connection and Three”…, 4096) = 629
  • read (4, “”, 4096) = 0
  • close (4) = 0
  • detail, etc/mysql/conf.d/mysqldump.cnf”, {st_mode=S_IFREG|0644, st_size=55, …}) = 0
  • openat (AT_FDCWD, “/, etc/mysql/conf.d/mysqldump.cnf”, O_RDONLY) = 4
  • fstat (4, {st_mode=S_IFREG|0644, st_size=55, …}) = 0
  • read (4, “[MySQL dump] nquicknquote-namesnma”…, 4096) = 55
  • read (4, “”, 4096) = 0
  • close (4) = 0
  • read (3, “”, 4096) = 0
  • close (3) = 0
  • detail (“/root/.my. cnf”, 0x7fff2e917880) = – 1 ENOENT (No such record or list)

The right one is finally in ‘/, etc/MySQL/conf.d/mysql.cf. Resulting in truly investigating the substance of the record, it is an empty archive. This is its essential driver. There has been some update and inverse present type of the MySQL Database Server, it making some disaster area the MySQL Database Server. The plan is essentially to fill that empty plan record with the right arrangement. The reference for the right arrangement of MySQL Database Server exists in this association. Restart the MySQL Server again, the above error issue will be tended to.

Is your database restore stuck with MySQL Error 2013 (hy000)?

Often queries or modifications in large databases result in MySQL errors due to server timeout limits.

At Bobcares, we often get requests to fix MySQL errors, as a part of our Server Management Services.

Today, let’s see how our Support Engineers fix MySQL Error 2013 (hy000) for our customers.

Why this MySQL Error 2013 (hy000) happens?

While dealing with MySQL, we may encounter some errors. Today, we are going to discuss one such error.

This MySQL 2013 error occurs during a restore of databases via mysqldump, in MySQL replication, etc.

This error appears when the connection between MySQL client and database server times out.

In general, this happens in databases with large tables. As a result, it takes too much time for the query to return data and the connection drops with an error.

Other reasons for the error include a large number of aborted connections, insufficient server memory, server restrictions, etc.

How do we fix MySQL Error 2013 (hy000)?

The fix for MySQL Error 2013 (hy000) depends a lot on the triggering reason. Let’s now see how our MySQL Engineers help customers solve it.

1. Changing MySQL limits

Recently, one of our customers approached us saying that he is getting an error like the one shown below while he is trying to connect with MySQL server.

MySQL Error 2013 (hy000)

So, our Engineers checked in detail and found that the connect_timeout value was set to only a few seconds. So, we increased it to 10 in the MySQL configuration file. For that, we followed the steps below:

Firstly, we opened the MySQL configuration file at /etc/mysql/my.cnf

Then, we searched for connect_timeout and set it as:

connect_timeout=10

Then we tried connecting with MySQL server and we were successful.

Additionally, it requires the proper setting of the variable max_allowed_packet in the MySQL configuration file too. While trying to restore the dump file in GB sizes, we increase the value to a higher one.

2. Disable Access restrictions

Similarly, this error also appears when the host has access restrictions. In such cases, we fix this by adding the client’s IP in /etc/hosts.allow or allow it in the server firewall.

Also, the error can happen due to the unavailability of the server. Recently, in a similar instance, the problem was not related to MySQL server or MySQL settings. We did a deep dig and found that high network traffic is causing the problem.

When we checked we found that a weird process running by the Apache user. So, we killed that and this fixed the error.

3. Increasing Server Memory

Last and not least, MySQL memory allocation also becomes a key factor for the error. Here, the server logs will have related entries showing the insufficient memory limit.

Therefore, our Dedicated Engineers reduce the innodb_buffer_pool size. This reduces the memory allocation on the server and fixes the error.

[Need assistance with MySQL errors – We can help you fix it]

Conclusion

In short, we discussed in detail on the causes for MySQL Error 2013 (hy000) and saw how our Support Engineers fix this error for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Понравилась статья? Поделить с друзьями:
  • Mysqladmin connect to server at localhost failed error access denied for user root localhost
  • Mysql2 error connectionerror access denied for user root localhost using password no
  • Mysql таблица используется ошибка
  • Mysql ошибка при импорте
  • Mysql ошибка 2013