Fixing MySQL

in #dev2 years ago

Pink Education Kindergarten Kid Class Promotion Facebook Post.png

So, the ratings did not work for several days. This is due to the nuances in working with MySQL in my scripts. They do not correctly terminate the connection to MySQL. I tried to deal with this topic for a long time, and eventually came to a temporary solution - restarting the Mysql service regularly on the server.

This weekend, for some reason, this method stopped working. Now I deal with it.

First of all, you can see what kind of connections you have to MySQL.

$mysql
$SHOW PROCESSLIST

$ service mysql restart

You can start manually creating a rating.
Let me remind you the list of running scripts.

$ node create.js
$ node create_spisok.js
$ node list.js
$ node addcom.js
$ node addpost.js
$ node create_day.js
$ node sortcom.js
$ node sortcom.js
$ node sortpost.js
$ node sortpost.js
$ node sum.js
$ node listcom.js
$ node listpost.js
$ node fulllist.js
$ node fulllistpost.js

Already halfway stopped working - too many connections.

I will try to increase the limit on the possible number of connections to Mysql:

$ nano /etc/mysqld/my.cnf
[mysqld]
max_connections=1000

And I'll reboot
$ service mysql restart

It works now. This does not negate the need to improve the work with MySQL in scripts so that they close correctly after the script has run. Those. solve the issue with sleep connections.

I will test how it will work in the next hours and days.

Thank you for your attention!
Have a nice day!

P.S.

Creating a user for remote connection to MySql:

CREATE USER 'nameofuser'@'10.100.155.100' IDENTIFIED BY 'password';
grant all privileges on *.* to 'nameofuser'@'10.100.155.100' with grant option;

When connected via mobile Internet, when there is a constant change of IP address - i.e. dynamic, these are frequently requested commands.

Coin Marketplace

STEEM 0.25
TRX 0.11
JST 0.032
BTC 62623.56
ETH 3037.97
USDT 1.00
SBD 3.70