MariaDB server is down but I can still login with mysql client (?) - mysql

MariaDB 10.3.8, Ubuntu 18 LTS.
When I check for the database status, I see that MariaDB is down. But I can login using the mysql client command. Is something wrong? How could I debug this?
sudo service mariadb status
mariadb.service - MariaDB 10.3.8 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: timeout) since Wed 2019-02-13 08:43:11 IST; 1min 0s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 3293 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 3712 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 3706 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 3693 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 3878 (mysqld)
Tasks: 13 (limit: 4915)
CGroup: /system.slice/mariadb.service
└─3878 /usr/sbin/mysqld
# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 2346 user_running_mariadb 31u IPv6 28910 0t0 TCP *:mysql (LISTEN)
ps uax | grep mysql
root 2049 0.0 0.0 4628 1812 ? S 08:40 0:00 /bin/sh /usr/bin/mysqld_safe
user_running_mariadb 2346 0.1 0.4 3005364 114444 ? Sl 08:40 0:02 /usr/sbin/mysqld --basedir=/usr --datadir=/my_db_files_dir --plugin-dir=/usr/lib/mysql/plugin --user=user_running_mariadb --skip-log-error --pid-file=/my_db_rundir/run/mysqld.pid --socket=/my_db_rundir/run/mysqld.sock --port=3306
#/my_db_rundir/run# ls -l
-rw-rw---- 1 user_running_mariadb group_running_mariadb 5 Feb 13 08:40 mysqld.pid
srwxrwxrwx 1 user_running_mariadb group_running_mariadb 0 Feb 13 08:40 mysqld.sock
#/my_db_rundir/run# cat mysqld.pid
2346
I can login:
mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 145
Server version: 10.3.8-MariaDB-1:10.3.8+maria~bionic-log mariadb.org
inary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
tatement.
MariaDB [(none)]>
Additional outputs:
Error log:
2019-02-13 8:52:13 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2019-02-13 8:52:13 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2019-02-13 8:52:13 0 [Note] InnoDB: Unable to open the first data file
2019-02-13 8:52:13 0 [ERROR] InnoDB: Operating system error number 11 in a file operation.
2019-02-13 8:52:13 0 [ERROR] InnoDB: Error number 11 means 'Resource temporarily unavailable'
journalctl -u mariadb.service
Feb 13 08:51:31 my_host systemd[1]: mariadb.service: Start operation timed out. Terminating.
Feb 13 08:52:13 my_host systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Feb 13 08:52:13 my_host systemd[1]: mariadb.service: Failed with result 'timeout'.
Feb 13 08:52:13 my_host systemd[1]: Failed to start MariaDB 10.3.8 database server.

The service is timed out ('Result: timeout'), and the service has the systemd configuration SendSIGKILL=no, which means systemd has just let mysqld continue running.
Why it time out? take a look at journalctl -u mariadb.service.

I could fix the issue, however I'm not completely sure about the root cause and what really fixed the issue. Still, perhaps this information helps others facing the same issue.
Reinstalled MariaDB and upgraded to 10.3.12. This wasn't probably needed because I kept hitting the same issue after the upgrade.
After reboot, noticed that msyqld status showed as active while mariadb as inactive:
/ati/mariadb/logs# sudo service mysql status
Loaded: loaded (/etc/init.d/mysql; generated)
Active: active (running)
Docs: man:systemd-sysv-generator(8)
Process: 1650 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
Tasks: 39 (limit: 4915)
CGroup: /system.slice/mysql.service
─2003 /bin/sh /usr/bin/mysqld_safe
─2301 /usr/sbin/mysqld --basedir=/usr...
└─2302 logger -t mysqld -p daemon error
sudo service mariadb status
mariadb.service - MariaDB 10.3.12 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: inactive (dead)
In MariaDB web site, found the way of enabling mariadb service, with
systemctl enable mariadb
Now, it works again.

Related

MySQL 8 & RHEL 7 - starting services automatically is failing

I'm trying to shutdown and startup a MySQL 8 installation gracefully on reboot.
I've enable the service with systemctl with the following command.
systemctl enable rh-mysql80-mysqld.service
After rebooting I check the status
root#localhost > systemctl status rh-mysql80-mysqld.service
● rh-mysql80-mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/rh-mysql80-mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2022-03-11 12:18:24 PST; 16min ago
Process: 1635 ExecStopPost=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /opt/rh/rh-mysql80/root/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
Process: 1242 ExecStart=/opt/rh/rh-mysql80/root/usr/libexec/mysqld-scl-helper enable $RH_MYSQL80_SCLS_ENABLED -- /opt/rh/rh-mysql80/root/usr/libexec/mysqld --basedir=/opt/rh/rh-mysql80/root/usr (code=exited, status=1/FAILURE)
Process: 1165 ExecStartPre=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /opt/rh/rh-mysql80/root/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Process: 1098 ExecStartPre=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /opt/rh/rh-mysql80/root/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Process: 1059 ExecStartPre=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /usr/bin/scl_enabled rh-mysql80 (code=exited, status=0/SUCCESS)
Main PID: 1242 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
I see this in the mysqld.log
/var/log/mysql/mysqld.log
2022-03-11T20:18:24.356194Z 0 [ERROR] [MY-011811] [Server] Can't start server: can't check PID filepath: No such file or directory
After executing the following commands I am able to manually start the service
[root#localhost ~]# sudo mkdir -p /var/run/rh-mysql80-mysqld/
[root#localhost ~]# sudo chown mysql.mysql /var/run/rh-mysql80-mysqld/
[root#localhost ~]# systemctl status rh-mysql80-mysqld.service
● rh-mysql80-mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/rh-mysql80-mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2022-03-11 12:58:16 PST; 58s ago
Process: 1635 ExecStopPost=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /opt/rh/rh-mysql80/root/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
Process: 14780 ExecStartPost=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /opt/rh/rh-mysql80/root/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
Process: 14678 ExecStartPre=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /opt/rh/rh-mysql80/root/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Process: 14647 ExecStartPre=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /opt/rh/rh-mysql80/root/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Process: 14641 ExecStartPre=/usr/bin/scl enable $RH_MYSQL80_SCLS_ENABLED -- /usr/bin/scl_enabled rh-mysql80 (code=exited, status=0/SUCCESS)
Main PID: 14721 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/rh-mysql80-mysqld.service
└─14721 /opt/rh/rh-mysql80/root/usr/libexec/mysqld --basedir=/opt/rh/rh-mysql80/root/usr
Mar 11 12:58:15 localhost systemd[1]: Starting MySQL 8.0 database server...
Mar 11 12:58:15 localhost scl[14647]: Socket file /var/lib/mysql/mysql.sock exists.
Mar 11 12:58:15 localhost scl[14647]: No process is using /var/lib/mysql/mysql.sock, which means it is a garbage, so it will be removed automatically.
Mar 11 12:58:16 localhost systemd[1]: Started MySQL 8.0 database server.
Can anyone tell me what needs to be done so that the service can successfully start on reboot without the manual intervention ?
OS Linux 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 16 12:17:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
UPDATE:
I think I found my problem.
While visiting google university I found other people had "fixed" the same or similar problem by creating a service to create the missing directory in /var/run. I tried this unsuccessfully for an hour or so.
I then stumbled across a MySQL bug report which sent me on a search to locate this file.
-rw-r--r-- 1 root root 44 Sep 16 05:05 /usr/lib/tmpfiles.d/rh-mysql80-mysqld.conf
The contents of this file
d /run/rh-mysql80-mysqld 0755 mysql mysql -
If this file exists, why is it not working. I took a look in /varlog/messages and found this:
Mar 11 15:43:03 systemd-tmpfiles: [/usr/lib/tmpfiles.d/rh-mysql80-mysqld.conf:1] Unknown group 'mysql'.
Mar 11 15:43:03 systemd: systemd-tmpfiles-setup.service: main process exited, code=exited, status=1/FAILURE
Mar 11 15:43:03 systemd: Unit systemd-tmpfiles-setup.service entered failed state.
Mar 11 15:43:03 systemd: systemd-tmpfiles-setup.service failed.
"mysql" wasnt in the /etc/group file (despite the groupadd command saying that it already existed) so I manually added it.
Made this change, rebooted.... and BOOM!!....Mysql started automatically!

apt upgrade mysqlserver freezes and will not upgrade (ubuntu server 20.04)

I had to kill the session and then the databases are inaccessible until I reboot the server.
When I log back in and issue ‘apt upgrade’ i get the following error.
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.
I run ‘dpkg --configure -a’ and get the following and then it just freezes
Setting up mysql-server-8.0 (8.0.22-0ubuntu0.20.04.3) ...
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 86150
On another tty
journalctl -xe gives this when the upgrade freezes.
-- The unit mysql.service has successfully entered the 'dead' state.
Jan 13 22:18:12 arpradio 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 582 and the job result is done.
Jan 13 22:18:13 arpradio audit[6057]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/usr/sbin/mysqld" pid>
Jan 13 22:18:13 arpradio kernel: audit: type=1400 audit(1610572693.036:16): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="uncon>
When I reboot and login mysqld is running
I have tried the following.
# cp -r /etc/mysql /etc/mysql_old
# apt autoremove
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.
# dpkg --configure -a
Setting up mysql-server-8.0 (8.0.22-0ubuntu0.20.04.3) ...
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 7451
And we are back here with the freeze.
If I check the mysql processes I find no process 7451 but this is the output.
# ps aux | grep mysql
root 1679 0.0 0.0 8644 4688 ? Ssl 22:23 0:00 dockerize -template /tmp/db.cnf.tmpl:/etc/mysql/conf.d/db.cnf /usr/local/bin/docker-entrypoint.sh mysqld
systemd+ 2526 0.3 0.1 2446780 99836 ? Sl 22:23 0:03 mysqld
root 7370 0.3 0.0 27940 19836 pts/0 S+ 22:38 0:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/mysql-server-8.0.postinst configure 8.0.22-0ubuntu0.20.04.2
root 7379 0.0 0.0 9756 3772 pts/0 S+ 22:38 0:00 /bin/bash /var/lib/dpkg/info/mysql-server-8.0.postinst configure 8.0.22-0ubuntu0.20.04.2
mysql 7657 1.9 0.5 1869164 358336 pts/0 Sl+ 22:39 0:01 mysqld --user=mysql --init-file=/var/lib/mysql-files/tmp.gQukBE7GtT --socket=/tmp/tmp.KUFQmDDseF/mysqld.sock --pid-file=/tmp/tmp.KUFQmDDseF/mysqld.pid
root 7759 0.0 0.0 9032 724 pts/1 S+ 22:39 0:00 grep --color=auto mysql
I checked the status of mysql.service
# systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2021-01-13 22:38:59 CET; 17min ago
Process: 649 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
Main PID: 649 (code=exited, status=0/SUCCESS)
Status: "Server shutdown complete"
Jan 13 22:21:43 arpradio systemd[1]: Starting MySQL Community Server...
Jan 13 22:21:45 arpradio systemd[1]: Started MySQL Community Server.
Jan 13 22:38:57 arpradio systemd[1]: Stopping MySQL Community Server...
Jan 13 22:38:59 arpradio systemd[1]: mysql.service: Succeeded.
Jan 13 22:38:59 arpradio systemd[1]: Stopped MySQL Community Server.
I fixed it, what I did was while the upgrade was hanging I ran
apt update && apt upgrade
on another tty and it upgraded everything, rebooted, I checked again after reboot and everything looks good.
# apt update
Hit:1 http://asi-fs-n.contabo.net/ubuntu focal InRelease
Hit:2 http://asi-fs-n.contabo.net/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 https://download.docker.com/linux/ubuntu focal InRelease
Hit:5 http://asi-fs-n.contabo.net/ubuntu focal-backports InRelease
Get:6 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Fetched 109 kB in 1s (112 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
root#arpradio:~# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root#arpradio:~# ps aux | grep mysql
mysql 657 1.2 0.6 2067208 378684 ? Ssl 23:09 0:02 /usr/sbin/mysqld
root 2148 0.1 0.0 9796 4784 ? Ssl 23:11 0:00 dockerize -template /tmp/db.cnf.tmpl:/etc/mysql/conf.d/db.cnf /usr/local/bin/docker-entrypoint.sh mysqld
systemd+ 2930 0.8 0.1 2380944 99508 ? Sl 23:11 0:00 mysqld
root 5507 0.0 0.0 9032 732 pts/0 S+ 23:12 0:00 grep --color=auto mysql
root#arpradio:~# systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-01-13 23:09:06 CET; 3min 26s ago
Process: 560 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 657 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 72284)
Memory: 419.9M
CGroup: /system.slice/mysql.service
└─657 /usr/sbin/mysqld
Jan 13 23:09:04 arpradio systemd[1]: Starting MySQL Community Server...
Jan 13 23:09:06 arpradio systemd[1]: Started MySQL Community Server.

Error:mysqld.service: Start request repeated too quickly. On manjaro

Yesterday I updated my manjaro. I had many problems since then.
Firstly, I type
systemctl status mysqld.service
to start MySQL, but it errors out with
mysqld.service: Start request repeated too quickly.
I has found many suggestions but they doesn't work.
I already have tried:
Check the permission of the MySQL data directory using the below command. The ownership should be mysql:mysql and the directory permission should be 700.
ls -ld /var/lib/mysql/
Check the permission of databases inside the MySQL data directory using the below command. The ownership should be mysql:mysql for all the files inside that directory.
ls -lh /var/lib/mysql/
Check the listening network TCP ports using the command
netstat -ntlp
Check the MySQL log files for any error using:
cat /var/log/mysql/mysqld.log
Try to start MySQL using
mysqld_safe --defaults-file=/etc/my.cf
My Error:
dong#dong-manjaro  /home/dong   systemctl status mysqld.service  13:30:33
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2019-08-22 13:30:29 CST; 6s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 8006 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Process: 8027 ExecStart=/usr/bin/mysqld $MYSQLD_OPTS (code=exited, status=127)
Main PID: 8027 (code=exited, status=127)
8月 22 13:30:29 dong-manjaro systemd[1]: mysqld.service: Service RestartSec=100ms expired, scheduling restart.
8月 22 13:30:29 dong-manjaro systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 5.
8月 22 13:30:29 dong-manjaro systemd[1]: Stopped MySQL Server.
8月 22 13:30:29 dong-manjaro systemd[1]: **mysqld.service: Start request repeated too quickly.**
8月 22 13:30:29 dong-manjaro systemd[1]: **mysqld.service: Failed with result 'exit-code'.**
8月 22 13:30:29 dong-manjaro systemd[1]: **Failed to start MySQL Server.**
I have faced same issue and solved this problem like that:
if /var/log/mysql folder not exists:
sudo mkdir /var/log/mysql
and then give permission this folder:
sudo chown -R mysql:mysql /var/log/mysql
sudo systemctl stop mysql
sudo systemctl start mysql
Ran into similar issue.Follow steps(Sql server Version: '8.0.22-0ubuntu0.20.04.3')
1. Edit file: mysqld.cnf under directory: /etc/mysql/mysql.conf.d
2. Ensure that below basic settings are made in file mysqld.cnf and save it.
# * Basic Settings
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
datadir = /var/lib/mysql
# setting for localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
log_error = /var/log/mysql/error.log
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
max_binlog_size = 100M
3. Check error log files under directory: /var/log/mysql
4. Remove all log files: Cd /var/log/mysql $ sudo rm -R error*
5. Start mysql server: $ sudo systemctl start mysql.service
6. Check status of mysql server: $ sudo systemctl status mysql.service
For us, it was to chown the logfile:
[root#tree ~]# ls -alh /var/log/mysqld.log
-rw-r----- 1 root logs 8.3K Apr 20 02:17 /var/log/mysqld.log
[root#tree ~]# chown mysql: /var/log/mysqld.log
[root#tree ~]# systemctl start mysqld
[root#tree ~]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-04-20 15:32:01 UTC; 20s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 28339 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 28313 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 28342 (mysqld)
Memory: 43.3G
CGroup: /system.slice/mysqld.service
└─28342 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Got rid of the same failure.
I fixed like this:
sudo chown -R mysql:mysql /var/lib/mysql
sudo systemctl start mysql

MYSQL don't start

Previously I performed the migration of my database from one directory to another within the server itself (/var/lib/mysql to /mnt/mysql) for lack of space.
When starting the server again, after having changed the /etc/my.cnf with the correct directory it returns me this error:
$ systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
And when I run the systemctl status command on the mysqld service it returns me:
$ systemctl status mysqld.service
mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Ter 2019-07-16 09:34:44 -03; 44s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 31923 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 31899 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 31923 (code=exited, status=1/FAILURE)
Status: "SERVER_BOOTING"
Error: 13 (Permission Denied)
Jul 16 09:34:43 srvepl.cettro.local systemd[1]: Starting MySQL Server...
Jul 16 09:34:44 srvepl.cettro.local systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jul 16 09:34:44 srvepl.cettro.local systemd[1]: Failed to start MySQL Server.
Jul 16 09:34:44 srvepl.cettro.local systemd[1]: Unit mysqld.service entered failed state.
Jul 16 09:34:44 srvepl.cettro.local systemd[1]: mysqld.service failed.
If it is permission error, how do I free the server to accept such a directory?
Note: I am using CentOS 7
Thank you!!
If you are using Linux or Unix Server then you should check the permissions of the user to access the service. Here I can see that the user which is logged in can't access the service because of the permission problem.
Try with.
sudo systemctl start mysqld;
Or try sudo su;, enter the creds of the superuser and then try to check the service status.
Or login as superuser and then try to start the service.
Hope this may help you.
After searching i discovered that the error was the 'enforcing' permission of SELINUX.
The answer to fix this problem is:
$ sudo setenforce 0
And the server went up normally.
Are you logged in with root user?
If no, try with sudo.
Otherwise, I think is better to restart your system and try again.
If you aren't expert in linux centos don't manipulate anything.
uninstall mysql and reinstall it.

Cannot get mysql to start with --skip-grant-tables on ubuntu 16

I lost my mysql password and need to reset it.
I have already tried https://help.ubuntu.com/community/MysqlPasswordReset
With the following result
erik#Trantor:~$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
erik#Trantor:~$ sudo /usr/sbin/mysqld --skip-grant-tables &
[1] 21335
erik#Trantor:~$
[1]+ Exit 1 sudo /usr/sbin/mysqld --skip-grant-tables
erik#Trantor:~$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
erik#Trantor:~$
I did not use the skip-networking option as that has been indicated by another post to cause it's own trouble and I'm not worried about security at the moment. Through some checking, I found that the service is failing to actually start with that option.
erik#Trantor:~$ sudo service mysql status
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
Active: inactive (dead) since Sun 2016-11-06 10:41:56 EST; 3min 45s ago
Process: 20846 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=e
Process: 20845 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
Process: 20842 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exi
Main PID: 20845 (code=exited, status=0/SUCCESS)
Nov 06 10:35:01 Trantor systemd[1]: Starting MySQL Community Server...
Nov 06 10:35:02 Trantor systemd[1]: Started MySQL Community Server.
Nov 06 10:41:55 Trantor systemd[1]: Stopping MySQL Community Server...
Nov 06 10:41:56 Trantor systemd[1]: Stopped MySQL Community Server.
lines 1-12/12 (END)
I'm not sure how to get mysql to start with the -skip-grant-tables option at this point, and without my password, I'm dead in the water.
I have tried to remove and install mysql-server again.
Anyone know how I can get it to start with the flag, or where I should look next?