mysql does not start on ubuntu 18.4 - php

My website is running on docker container, which is working fine. I am trying to connect my online website's database with admin panel on local host. So I was trying to enable remote access to mysql database server. For that I added some changes in /etc/mysql/my.cnf file and on restarting mysql service I've got this error.
I think I have error in starting MYSQL COMMUNITY SERVER.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
and after running systemctl status mysql.service, I get this result
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-10-02 13:43:29 UTC; 40min ago
Process: 26628 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Control process exited, code=exited status=1
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: Failed to start MySQL Community Server.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: Stopped MySQL Community Server.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Start request repeated too quickly.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: Failed to start 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.
Oct 02 14:24:59 ip-172-31-31-42 systemd[1]: mysql.service: Start request repeate
Oct 02 14:24:59 ip-172-31-31-42 systemd[1]: mysql.service: Failed with result 'e
Oct 02 14:24:59 ip-172-31-31-42 systemd[1]: Failed to start MySQL Community Serv
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
what could be the possible solution?
I have already tried the all other alternative commands to start mysql server but nothing works out.
This is error message I'm getting in my console.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.

Related

Unable to start Apache2: Job for apache2.service failed because the control process exited with error code

See "systemctl status apache2.service" and "journalctl -xe" for details.
root#ip-172-31-43-5:/home/ubuntu/asterisk-18.13.0/freepbx# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-07-27 08:30:40 UTC; 8s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 11172 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jul 27 08:30:40 ip-172-31-43-5 systemd[1]: Starting The Apache HTTP Server...
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11175]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11175]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11175]: no listening sockets available, shutting down
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11175]: AH00015: Unable to open logs
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11172]: Action 'start' failed.
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11172]: The Apache error log may have more information.
Jul 27 08:30:40 ip-172-31-43-5 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jul 27 08:30:40 ip-172-31-43-5 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jul 27 08:30:40 ip-172-31-43-5 systemd[1]: Failed to start The Apache HTTP Server.
uninstall apache and reinstall again
sudo apt-get install apache2
install Apache2
sudo a2enmod proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http

Connecting to MySQL without pw - Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I have a Wordpress website that used to work fine, but recently I received the message "Error establishing a database connection" when trying to navigate to it. Upon researching online, I realized it may be related to changing my db password.
So I am following instructions on resetting the Mysql pw from here - https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password.
Steps:
sudo systemctl stop mysql
sudo mysqld_safe --skip-grant-tables --skip-networking &
Output:
2019-08-25T15:23:22.702830Z mysqld_safe Logging to syslog.
2019-08-25T15:23:22.707805Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2019-08-25T15:23:22.712056Z mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.
I then do:
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
and then run
sudo mysqld_safe --skip-grant-tables --skip-networking &
Output
2019-08-25T15:33:49.404761Z mysqld_safe Logging to syslog.
2019-08-25T15:33:49.411891Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2019-08-25T15:33:49.443922Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-08-25T15:33:49.992471Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
From here, I do mysql -u root, and see this
Output:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Troubleshooting done so far
To troubleshoot, I followed the suggestions from this post to find the sock file. I tried to do by by
sudo find / -type s to find the mysql.sock file, but do not find it in the list.
Output:
/run/acpid.socket
/run/dbus/system_bus_socket
/run/snapd-snap.socket
/run/snapd.socket
/run/uuidd/request
/run/user/0/systemd/private
/run/user/0/systemd/notify
/run/fail2ban/fail2ban.sock
/run/lvm/lvmpolld.socket
/run/lvm/lvmetad.socket
/run/systemd/journal/dev-log
/run/systemd/journal/socket
/run/systemd/journal/stdout
/run/systemd/journal/syslog
/run/systemd/private
/run/systemd/notify
/run/udev/control
/var/lib/lxd/unix.socket
/var/spool/postfix/private/proxywrite
/var/spool/postfix/private/relay
/var/spool/postfix/private/ifmail
/var/spool/postfix/private/retry
/var/spool/postfix/private/defer
/var/spool/postfix/private/maildrop
/var/spool/postfix/private/mailman
/var/spool/postfix/private/discard
/var/spool/postfix/private/anvil
/var/spool/postfix/private/scalemail-backend
/var/spool/postfix/private/bsmtp
/var/spool/postfix/private/bounce
/var/spool/postfix/private/verify
/var/spool/postfix/private/trace
/var/spool/postfix/private/uucp
/var/spool/postfix/private/lmtp
/var/spool/postfix/private/local
/var/spool/postfix/private/error
/var/spool/postfix/private/rewrite
/var/spool/postfix/private/proxymap
/var/spool/postfix/private/smtp
/var/spool/postfix/private/tlsmgr
/var/spool/postfix/private/scache
/var/spool/postfix/private/virtual
/var/spool/postfix/public/showq
/var/spool/postfix/public/qmgr
/var/spool/postfix/public/pickup
/var/spool/postfix/public/cleanup
/var/spool/postfix/public/flush
/var/spool/postfix/dev/log
I tried to restart the server by sudo service mysql start but got this output
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
The output for systemctl status mysql.service is
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Sun 2019-08-25 15:41:53 UTC; 27s ago
Process: 16974 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 16966 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCE
Main PID: 16974 (code=exited, status=1/FAILURE); : 16975 (mysql-systemd-s)
Tasks: 2
Memory: 5.1M
CPU: 331ms
CGroup: /system.slice/mysql.service
└─control
├─16975 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─17042 sleep 1
Aug 25 15:41:53 keshinpoint systemd[1]: Starting MySQL Community Server...
Aug 25 15:41:53 keshinpoint systemd[1]: mysql.service: Main process exited, code=exited, status=1/F
The output for journalctl -xe is
-- Unit mysql.service has finished shutting down.
Aug 25 21:08:08 keshinpoint 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 25 21:08:08 keshinpoint audit[7730]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/
Aug 25 21:08:08 keshinpoint audit[7730]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/
Aug 25 21:08:08 keshinpoint audit[7730]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/
Aug 25 21:08:08 keshinpoint kernel: audit: type=1400 audit(1566767288.456:105247): apparmor="DENIED
Aug 25 21:08:08 keshinpoint kernel: audit: type=1400 audit(1566767288.460:105248): apparmor="DENIED
Aug 25 21:08:08 keshinpoint kernel: audit: type=1400 audit(1566767288.460:105249): apparmor="DENIED
Aug 25 21:08:08 keshinpoint systemd[1]: mysql.service: Main process exited, code=exited, status=1/F
Aug 25 21:08:38 keshinpoint 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 25 21:08:38 keshinpoint systemd[1]: mysql.service: Unit entered failed state.
Aug 25 21:08:38 keshinpoint systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 25 21:08:38 keshinpoint systemd[1]: mysql.service: Service hold-off time over, scheduling resta
Aug 25 21:08:38 keshinpoint 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 25 21:08:38 keshinpoint 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
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Aug 25 21:08:38 keshinpoint 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 25 21:08:38 keshinpoint audit[7815]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/7815/status" pid=7815 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid
Aug 25 21:08:38 keshinpoint kernel: audit: type=1400 audit(1566767318.940:105250): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/7815/status" pid=7815 comm="mysqld" requested_m
Aug 25 21:08:38 keshinpoint audit[7815]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=7815 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=
Aug 25 21:08:38 keshinpoint audit[7815]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/7815/status" pid=7815 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid
Aug 25 21:08:38 keshinpoint kernel: audit: type=1400 audit(1566767318.948:105251): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=7815 comm="mysqld" req
Aug 25 21:08:38 keshinpoint kernel: audit: type=1400 audit(1566767318.948:105252): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/7815/status" pid=7815 comm="mysqld" requested_m
Aug 25 21:08:39 keshinpoint systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Aug 25 21:08:44 keshinpoint kernel: [UFW BLOCK] IN=eth0 OUT= MAC=8e:96:82:1a:cc:9e:5c:45:27:78:fb:30:08:00 SRC=81.22.45.100 DST=174.138.62.216 LEN=40 TOS=0x00 PREC=0x20 TTL=245 ID=10892 PROTO=TCP SPT=4071
Aug 25 21:08:47 keshinpoint kernel: [UFW BLOCK] IN=eth0 OUT= MAC=8e:96:82:1a:cc:9e:5c:45:27:78:fb:30:08:00 SRC=51.81.7.101 DST=174.138.62.216 LEN=40 TOS=0x14 PREC=0x00 TTL=246 ID=54321 PROTO=TCP SPT=36258
Aug 25 21:08:53 keshinpoint sshd[7855]: Invalid user www from 51.38.186.228
Aug 25 21:08:53 keshinpoint sshd[7855]: input_userauth_request: invalid user www [preauth]
Aug 25 21:08:53 keshinpoint sshd[7855]: pam_unix(sshd:auth): check pass; user unknown
Aug 25 21:08:53 keshinpoint sshd[7855]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=51.38.186.228
Aug 25 21:08:56 keshinpoint sshd[7855]: Failed password for invalid user www from 51.38.186.228 port 60446 ssh2
Feels like a rabbit hole here. Can someone please help me with this? I would be grateful for any guidance offered, as Ive tried answers from multiple stackoverflow posts.

Failed to start the Apache HTTP Server - Ubuntu 18.04

I am completely new to Ubuntu and everything and am just trying to set up MyBB on my VPS with OVH. When I restart my Apache server using sudo systemctl -l status apache2, I get an error that says:
Nov 02 09:48:19 vps607432 systemd[1]: Starting The Apache HTTP Server...
Nov 02 09:48:19 vps607432 apachectl[18213]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Nov 02 09:48:19 vps607432 apachectl[18213]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Nov 02 09:48:19 vps607432 apachectl[18213]: no listening sockets available, shutting down
Nov 02 09:48:19 vps607432 apachectl[18213]: AH00015: Unable to open logs
Nov 02 09:48:19 vps607432 apachectl[18213]: Action 'start' failed.
Nov 02 09:48:19 vps607432 apachectl[18213]: The Apache error log may have more information.
Nov 02 09:48:19 vps607432 systemd[1]: apache2.service: Control process exited, code=exited status=1
Nov 02 09:48:19 vps607432 systemd[1]: apache2.service: Failed with result 'exit-code'.
Nov 02 09:48:19 vps607432 systemd[1]: Failed to start The Apache HTTP Server.
I understand what the issue is here as it plainly says inside of the error what is wrong. It's just that I am unsure on how I would go about solving this issue that I am experiencing.
Thanks for taking the time to read this question, I hope that I am able to find a solution as fast as possible.

php-fpm can't start up "unknown entry '$listen'"

I install php7 on centos7,but I use 'systemctl start php-fpm' command,
it can't startup,so I execute "systemctl status php-fpm.service",and get the result below:
# systemctl status php-fpm.service
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2018-03-03 15:31:52 EST; 7min ago
Process: 12841 ExecStart=/usr/sbin/php-fpm --nodaemonize (code=exited, status=78)
Main PID: 12841 (code=exited, status=78)
Mar 03 15:31:51 instance-1 systemd[1]: Starting The PHP FastCGI Process Manager...
Mar 03 15:31:52 instance-1 php-fpm[12841]: [03-Mar-2018 15:31:52] ERROR: [/etc/php-fpm.d/www.conf:12] unknown entry '#listen'
Mar 03 15:31:52 instance-1 php-fpm[12841]: [03-Mar-2018 15:31:52] ERROR: Unable to include /etc/php-fpm.d/www.conf from /etc/php-fpm.conf at line 12
Mar 03 15:31:52 instance-1 php-fpm[12841]: [03-Mar-2018 15:31:52] ERROR: failed to load configuration file '/etc/php-fpm.conf'
Mar 03 15:31:52 instance-1 php-fpm[12841]: [03-Mar-2018 15:31:52] ERROR: FPM initialization failed
Mar 03 15:31:52 instance-1 systemd[1]: php-fpm.service: main process exited, code=exited, status=78/n/a
Mar 03 15:31:52 instance-1 systemd[1]: Failed to start The PHP FastCGI Process Manager.
Mar 03 15:31:52 instance-1 systemd[1]: Unit php-fpm.service entered failed state.
Mar 03 15:31:52 instance-1 systemd[1]: php-fpm.service failed.
How can I fix that?

unable to start service of apache2

These are the follow output streamed when I give command to restart the service of apache
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2017-08-08 11:14:56 IST; 42s ago
Docs: man:systemd-sysv-generator(8)
Process: 3568 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)
Aug 08 11:14:56 Lab2-73 systemd[1]: Starting LSB: Apache2 web server...
Aug 08 11:14:56 Lab2-73 apache2[3568]: /etc/init.d/apache2: 46: .: Can't open /e
Aug 08 11:14:56 Lab2-73 apache2[3568]: /etc/init.d/apache2: 57: .: Can't open /e
Aug 08 11:14:56 Lab2-73 apache2[3568]: ERROR: APACHE_PID_FILE needs to be define
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Control process exited, cod
Aug 08 11:14:56 Lab2-73 systemd[1]: Failed to start LSB: Apache2 web server.
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Unit entered failed state.
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Failed with result 'exit-co
Please check your configuration under /etc/init.d/apache2/. There migth be a misconfiguration. Have a look at this little guide.
If you cant find the mistake you can also reinstall apache2 but keep in mind that you will loose your whole configuration (depending on the actual configuration)

Categories