Express.JS app is conflicting with mysql server - mysql

I'm having a bad day trying to find the reason why this bug is occurring to me.
when I run the express.js app (using pm2) it makes MySQL 5.7 server stop and when I try to restart the MySQL server it outputs an error.
Bear in mind that the express.js app is running on port 80 and MySQL is running on port 3306. and that the express.js app is not trying to talk or connect to MySQL in any ways so they shouldn't interact with each other.
Platform: Digital Ocean, OS: Ubuntu 16.04, Node Version: 8.2.1, MySQL
Version: 5.7
`journalctl -xe` output :
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mysql.service has begun starting up. Aug 07 19:37:35 ubuntu-512mb-lon1-01 systemd[1]: mysql.service: Main process exited,
code=exited, status=1/FAILURE Aug 07 19:37:49 ubuntu-512mb-lon1-01
sshd[20843]: Invalid user db2fenc1 from xxxxxx Aug 07 19:37:49
ubuntu-512mb-lon1-01 sshd[20843]: input_userauth_request: invalid user
db2fenc1 [preauth] Aug 07 19:37:49 ubuntu-512mb-lon1-01 sshd[20843]:
pam_unix(sshd:auth): check pass; user unknown Aug 07 19:37:49
ubuntu-512mb-lon1-01 sshd[20843]: pam_unix(sshd:auth): authentication
failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxxx. Aug 07
19:37:51 ubuntu-512mb-lon1-01 sshd[20843]: Failed password for invalid
user db2fenc1 from xxxxxx port 60654 ssh2 Aug 07 19:37:51
ubuntu-512mb-lon1-01 sshd[20843]: Received disconnect from xxxxx port
60654:11: Normal Shutdown, Thank you for playing [preau Aug 07
19:37:51 ubuntu-512mb-lon1-01 sshd[20843]: Disconnected from xxxxx
port 60654 [preauth] Aug 07 19:38:05 ubuntu-512mb-lon1-01 systemd[1]:
Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mysql.service has failed.
-- The result is failed. Aug 07 19:38:05 ubuntu-512mb-lon1-01 systemd[1]: mysql.service: Unit entered failed state. Aug 07 19:38:05
ubuntu-512mb-lon1-01 systemd[1]: mysql.service: Failed with result
'exit-code'. Aug 07 19:38:05 ubuntu-512mb-lon1-01 systemd[1]:
mysql.service: Service hold-off time over, scheduling restart. Aug 07
19:38:05 ubuntu-512mb-lon1-01 systemd[1]: Stopped MySQL Community
Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mysql.service has finished shutting down. Aug 07 19:38:05 ubuntu-512mb-lon1-01 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mysql.service has begun starting up. Aug 07 19:38:05 ubuntu-512mb-lon1-01 systemd[1]: mysql.service: Main process exited,
code=exited, status=1/FAILURE

Could you provide the logs from mysql logs? if it's using the default settings, it will be in /var/log/mysq/

Related

MySql 5.7 Server Can't Be Terminated

I installed MySql 5.7 for work, now I got an active MySql server running on standart port 3306, that I can't terminate.
I tried service mysql stop and service mysqld stop. No active processes as well.
This is the output of service mysql status :
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-11-16 10:09:46 CET; 9min ago
Process: 65951 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 65990 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Nov 16 10:09:44 user systemd[1]: Starting MySQL Community Server...
Nov 16 10:09:44 user mysqld[65990]: Initialization of mysqld failed: 0
Nov 16 10:09:44 user systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Nov 16 10:09:46 user systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 16 10:09:46 user systemd[1]: Stopped MySQL Community Server.
localhost:3006 Response :
Response
Output of journalctl -xe :
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has finished with a failure.
--
-- The job identifier is 13189 and the job result is failed.
Nov 16 10:36:40 user systemd[1]: mysql.service: Scheduled restart job, restart counter is at 37.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 16 10:36:40 user systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit mysql.service has finished.
--
-- The job identifier is 13262 and the job result is done.
Nov 16 10:36:40 user systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has begun execution.
--
-- The job identifier is 13262.
Nov 16 10:36:40 user audit[71661]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/usr/sbin/mysqld>
Nov 16 10:36:40 user kernel: audit: type=1400 audit(1668591400.604:1307): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=>
Nov 16 10:36:40 user mysqld[71662]: Initialization of mysqld failed: 0
Nov 16 10:36:40 user systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit mysql.service has exited.

cant start mysql server

I cannot start Mysql-server on ubuntu 20.04 when I try systemctl status mysql.service i got this message:
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-08-24 11:27:20 UTC; 12s ago
Process: 46074 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited,
status=1/FAILURE)
Aug 24 11:27:20 virtualmin systemd[1]: mysql.service: Control process exited,
code=exited, status=1/FAILURE
Aug 24 11:27:20 virtualmin systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 24 11:27:20 virtualmin systemd[1]: Failed to start MySQL Community Server.
Aug 24 11:27:20 virtualmin systemd[1]: mysql.service: Scheduled restart job, restart
counter is at 5.
Aug 24 11:27:20 virtualmin systemd[1]: Stopped MySQL Community Server.
Aug 24 11:27:20 virtualmin systemd[1]: mysql.service: Start request repeated too
quickly.
Aug 24 11:27:20 virtualmin systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 24 11:27:20 virtualmin systemd[1]: Failed to start MySQL Community Server.
mostly other service is running on the same port (3306) ,
try
netstat -pnltu | grep -i "3306"
it will show all services running on that port , if there are any , just end it and restart your Mysql server

I tried to reinstall MySQL on centos and now it doesn't start

I tried to reinstall MySQL and now it doesn't even start, and if I go to "messages" it says this
Jul 23 11:04:27 systemd: Starting MySQL Server...
Jul 23 11:04:29 systemd: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jul 23 11:04:29 systemd: Failed to start MySQL Server.
Jul 23 11:04:29 systemd: Unit mysqld.service entered failed state.
Jul 23 11:04:29 systemd: mysqld.service failed.

Unable to start mysql in ubuntu

I have tried the following the code to restart the MySql services
sudo service mysql restart
got the following error
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
ubuntu#ip-172-31-52-10:~$ journalctl -xe
And the journalctl Log says
Unit mysql.service has begun starting up.
Mar 17 15:10:55 ip-172-31-52-10 audit[4057]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=4057 comm="mysqld" r
Mar 17 15:10:55 ip-172-31-52-10 kernel: audit: type=1400 audit(1552835455.957:54): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/syst
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: ERROR: Unable to start MySQL server:
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: 2019-03-17T15:10:56.000286Z 0 [ERROR] unknown variable 'bind=0.0.0.0'
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: 2019-03-17T15:10:56.004319Z 0 [ERROR] Aborting
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: Once the problem is resolved, restart the service.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Control process exited, code=exited status=1
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Failed with result 'exit-code'.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has finished shutting down.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Start request repeated too quickly.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Failed with result 'exit-code'.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
how do I fix this?

Can't start MySQL after RHEL upgrade to 7.2, Unregistered Authentication Agent

I just upgraded my RHEL system from 6.7 to 7.2, and am having issues starting up MySQL again.
When running:
# systemctl start mysqld
I get this error:
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
systemctl status tells me the following:
● mysqld.service - SYSV: MySQL database server.
Loaded: loaded (/etc/rc.d/init.d/mysqld)
Active: failed (Result: exit-code) since Tue 2017-05-02 10:00:52 CDT; 59s ago
Docs: man:systemd-sysv-generator(8)
Process: 21827 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)
May 02 10:00:51 sa-dnca01.zs.local systemd[1]: Starting SYSV: MySQL database server....
May 02 10:00:52 sa-dnca01.zs.local mysqld[21827]: MySQL Daemon failed to start.
May 02 10:00:52 sa-dnca01.zs.local mysqld[21827]: Starting mysqld: [FAILED]
May 02 10:00:52 sa-dnca01.zs.local systemd[1]: mysqld.service: control process exited, code=exited status=1
May 02 10:00:52 sa-dnca01.zs.local systemd[1]: Failed to start SYSV: MySQL database server..
May 02 10:00:52 sa-dnca01.zs.local systemd[1]: Unit mysqld.service entered failed state.
May 02 10:00:52 sa-dnca01.zs.local systemd[1]: mysqld.service failed.
And then journalctl -xe tells me the following:
May 02 10:03:09 sa-dnca01.zs.local polkitd[768]: Registered Authentication Agent for unix-process:22276:29249716 (system bus name :1.30 [/usr/bin/
May 02 10:03:09 sa-dnca01.zs.local systemd[1]: Starting SYSV: MySQL database server....
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has begun starting up.
May 02 10:03:10 sa-dnca01.zs.local mysqld[22281]: MySQL Daemon failed to start.
May 02 10:03:10 sa-dnca01.zs.local mysqld[22281]: Starting mysqld: [FAILED]
May 02 10:03:10 sa-dnca01.zs.local systemd[1]: mysqld.service: control process exited, code=exited status=1
May 02 10:03:10 sa-dnca01.zs.local systemd[1]: Failed to start SYSV: MySQL database server..
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
May 02 10:03:10 sa-dnca01.zs.local systemd[1]: Unit mysqld.service entered failed state.
May 02 10:03:10 sa-dnca01.zs.local systemd[1]: mysqld.service failed.
May 02 10:03:10 sa-dnca01.zs.local polkitd[768]: Unregistered Authentication Agent for unix-process:22276:29249716 (system bus name :1.30, object
I don't really know what any of this means, but I did have a successfully running MySQL server before the server had an OS upgrade.
Turns out I was getting this error because I hadn't created the necessary logging directory in:
/var/run/mysqld
and given it the proper permissions.
Looking at the log file in /var/log/mysqld.log led me to the issue.