Webmin MySQL Error on starting - mysql

Firstly, I must say that I have not used these tools in the past so linux commands are not familiar to me.
Backstory:
On my Webmin server, I have been trying to get a Drupal Installation to work. I changed a parameter on the MySQL module and now the MySQL will not start.
Current Situation:
When I click "Start MySQL Server" I receive the follow:
Failed to start database : Redirecting to /bin/systemctl start
mariadb.service Job for mariadb.service failed because the control
process exited with error code. See "systemctl status mariadb.service"
and "journalctl -xe" for details.
I've search around this, and most people recommend to reinstall MariaDB.
I connected to the server with putty to get some more information
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2017-08-01 16:29:00 UTC; 7min ago
Process: 22851 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 22850 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 22823 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 22850 (code=exited, status=0/SUCCESS)
Aug 01 16:28:57 li172-89.members.linode.com systemd[1]: Starting MariaDB database server...
Aug 01 16:28:57 li172-89.members.linode.com mysqld_safe[22850]: 170801 16:28:57 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Aug 01 16:28:57 li172-89.members.linode.com mysqld_safe[22850]: 170801 16:28:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Aug 01 16:29:00 li172-89.members.linode.com systemd[1]: mariadb.service: control process exited, code=exited status=1
Aug 01 16:29:00 li172-89.members.linode.com systemd[1]: Failed to start MariaDB database server.
Aug 01 16:29:00 li172-89.members.linode.com systemd[1]: Unit mariadb.service entered failed state.
Aug 01 16:29:00 li172-89.members.linode.com systemd[1]: mariadb.service failed.
[root#li172-89 ~]#
I gather that this means Mariadb wont even start so I should probably reinstall it. I did try to simply use a defaul my.cnf but that didn't really do anything.
Ideally, I do not want to lose any of the databases I have.
What should I do? Should I reinstall Mariadb? Is there a suitable guide that lists the commands? Could I install Mariadb but to another folder?
What is the best course of action at this point?

Related

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.

ERROR 2006 (HY000): MySQL server has gone away & conflict with max_allowed_packet

I wanted to import a sql dump
mysql -u username mydb < file.sql
And of course i get the classic ERROR 2006 (HY000) at line 1701: MySQL server has gone away message. No big deal i know that i need to increase the packet size. So i edit the /etc/mysql/mysql.cnf file and add the line max_allowed_packet=64M. But when i try to start the mysql server i get an error.
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-01-21 16:27:47 CET; 15s ago
Process: 9151 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Process: 9112 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 27620 (code=exited, status=0/SUCCESS)
Jan 21 16:27:47 aleksandar-pc systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 21 16:27:47 aleksandar-pc systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Jan 21 16:27:47 aleksandar-pc systemd[1]: Stopped MySQL Community Server.
Jan 21 16:27:47 aleksandar-pc systemd[1]: mysql.service: Start request repeated too quickly.
Jan 21 16:27:47 aleksandar-pc systemd[1]: mysql.service: Failed with result 'exit-code'.
If i remove the code added for packets, the server can be started normally.
Can anyone help me with this, i really need to import this large db and don't know how to fix this mysql error.
Mysql verison: Ver 14.14 Distrib 5.7.25, for Linux (x86_64)
Linux: Ubuntu 18.04 LTS
Ok i forgot this [mysqld] above:
[mysqld]
max_allowed_packet=128M

MySQL general_log cannot be enabled. What am I doing wrong?

I'm on Ubuntu 18.04 with MySQL 5.7.24 and I'm trying to enable the general_log as described here.
So in my /etc/mysql/my.cnf I added this:
general_log = on
general_log_file=/tmp/mysql.log
I then stopped and started mysql again, but I get an error:
$ sudo service mysql stop
$ sudo service mysql start
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
So I checked out systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-01-04 17:50:31 CET; 45s ago
Process: 27206 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)
Process: 27613 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Main PID: 27208 (code=exited, status=0/SUCCESS)
Jan 04 17:50:31 librem systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 04 17:50:31 librem systemd[1]: Failed to start MySQL Community Server.
Jan 04 17:50:31 librem systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 04 17:50:31 librem systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Jan 04 17:50:31 librem systemd[1]: Stopped MySQL Community Server.
Jan 04 17:50:31 librem systemd[1]: mysql.service: Start request repeated too quickly.
Jan 04 17:50:31 librem systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 04 17:50:31 librem systemd[1]: Failed to start MySQL Community Server.
In journalctl -xe I get pretty much the same.
I tried creating the log file in /tmp/mysql.log and chmodding it to 777, but after doing that, starting up mysql fails with the same errors.
Does anybody know what's wrong here?
In the end I solved it using this tip. Just copy pasting it here for future readers:
SET global log_output = 'FILE';
SET global general_log_file='/var/log/mysql/general.log';
SET global general_log = 1;
No need to restart. The user does need the SUPER privilege (GRANT SUPER ON *.* TO user1#localhost). This works for existing and new connections on the DB and is a global setting so it works for all databases.
It can be turned off with
SET global general_log = 0;

Mysql Error ERROR 2002 (HY000) persists after full reinstall

So I've been working on a rails server with MySQL and suddenly can't access my database. When I try to log in with mysql -u root -p I get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2). I've read most of the forums I can find and looked through all the logs trying to reset mysqld.sock. I've tried reinstalling and repackaging unsuccessfully. The weird thing is that var/run/mysqld/ doesn't even exist after reinstalling.
So I decided to just back up my databases and overhaul everything. I cleaned out both apache and mysql with apt-get remove --purge and reinstalled. All went fine, apache launched fine, and then tried to relaunch mysql with systemctl start mysql which gave a prompt to check the log which says:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2016-12-16 23:56:19 UTC; 17s ago
Process: 15690 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Control process exited, code=exited status=1
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Failed to start MySQL Community Server.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Unit entered failed state.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Failed with result 'exit-code'.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Stopped MySQL Community Server.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Start request repeated too quickly.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Failed to start MySQL Community Server.
Update - I created the folder mysqld, which seems to allow sudo mysqld --initialize to run. Unfortunately this yielded the error
2016-12-17T00:16:36.298825Z 0 [ERROR] Can't change data directory owner to mysql
2016-12-17T00:16:36.299212Z 0 [ERROR] Aborting
So no party yet. Any thoughts would be hugely appreciated.
edit /etc/mysql/conf.d/mysql.cnf :
sudo nano /etc/mysql/conf.d/mysql.cnf
add this line :
socket=/var/run/mysqld/mysqld.sock
then restart mysql service :
sudo service mysql restart

mysql randomly stopped working

hi my mysql was working i did nothing on it then today when i went to login to multicraft it gave me error 500 which means theres an issue with mysql and i tried to do $service mysql restart it didnt work so i did $service mysql status and i got this error
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Wed 2016-01-27 16:39:39 CET; 24min >ago
Process: 27320 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 28147 ExecStart=/etc/init.d/mysql start (code=exited, >status=1/FAILURE)
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Starting LSB: Start and >sto...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu mysql[28147]: /etc/init.d/mysql: >ERROR:...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: mysql.service: control >proc...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Failed to start LSB: Start >...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Unit mysql.service entered >...
Hint: Some lines were ellipsized, use -l to show in full.
look in your /var/log/mysql/*.log logs
try to start mysql on the commandline
Example:
as root user: mysqld --console