Archlinux mysqld won't launch - mysql

Cat' launch mysqld on my archlinux x64.
Job for mysqld.service failed. See "systemctl status mysqld.service" and "journalctl -xe" for details.
after systemctl start mysqld
in log
mysqld.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: timeout) since Mon 2015-04-06 22:07:24 UTC; 9ms ago
Process: 18077 ExecStart=/usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Main PID: 18077 (code=exited, status=1/FAILURE)
CGroup: /system.slice/mysqld.service
`-control
Apr 06 22:07:24 atlas systemd[1]: Failed to start MariaDB database server.
Apr 06 22:07:24 atlas systemd[1]: Unit mysqld.service entered failed state.
Apr 06 22:07:24 atlas systemd[1]: mysqld.service failed.
What can i do? Thanks!

You will get detailed info in systemd journal: sudo journalctl -f then, on an other terminal, start mysql: sudo systemctl start mysqld to get logs on the first terminal. You will likely get error messages that will help you figure out what goes wrong.

You should type this command before starting the service
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
ِAnd later you can start the service Regularly
For one session:
systemctl start mysqld
OR being enabled automatically on startup << (NOT RECOMMENDED)
systemctl enable mysqld

Did you follow the install instruction on the ArchLinux Wiki ?
https://wiki.archlinux.org/index.php/MySQL#Installation
As mentionned by Medo Tareq, you need to run the following command :
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
(Obviously you can adjust the parameters on the command, if you know what you are doing.)
The Wiki page also has other hint and information, notably about the mysql_secure_installation command that "will interactively guide you through a number of recomended security measures at the database level".

Try change the permission of MySQL folder. If you are working locally and try to reinstall MySQL again after runing this command, it will work.
sudo chmod -R 755 /var/lib/mysql/

Related

can not start mysql service in centos 7

i tried to start the mysql service but it's not work.
while i use this command
service start mysql
this error happens!
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
but when i tried to use systemctl it's still not work
[root#master-1 ~]# systemctl start mysql
Failed to start mysql.service: Unit not found.
[root#master-1 ~]# systemctl start mysqld
Failed to start mysqld.service: Unit not found.
[root#master-1 ~]#
this is the result for systemctl status mysqld mysql
● mysqld.service
Loaded: not-found (Reason: No such file or directory)
Active: failed (Result: exit-code) since Mon 2021-07-12 10:01:13 WIB; 1 weeks 1 days ago
Main PID: 872 (code=exited, status=1/FAILURE)
Status: "Data Dictionary upgrade from MySQL 5.7 in progress"
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
● mysql.service
Loaded: not-found (Reason: No such file or directory)
Active: failed (Result: exit-code) since Fri 2021-07-16 17:13:43 WIB; 3 days ago
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
i still don't know what happen
Hello systemctl works in Ubuntu Os, Not in CentOS.
please use [/etc/init.d/mysqld restart, /etc/init.d/mysqld start, /etc/init.d/mysqld stop] instead of systemctl start mysql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

Ok so all of a sudden sql is not working properly on my server. When i run sudo service mysql start it says:
Job for mysql.service failed because a fatal signal was delivered to the control process.
See "systemctl status mysql.service" and "journalctl -xe" for details.
When i run systemctl status mysql.service it shows:
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start) since Wed 2021-04-14 03:08:17 UTC; 4s ago
Process: 12884 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 12892 (mysqld)
Status: "Server startup in progress"
Tasks: 2 (limit: 1136)
Memory: 2.7M
CGroup: /system.slice/mysql.service
└─12892 [mysqld]
When i run journalctl -xe is shows:
Apr 14 03:04:43 otzivio-ubuntu-s-1vcpu-1gb-intel-fra1-01 sudo[11492]: pam_unix(sudo:auth):
authentication failure; logname=ashok uid=1000 euid=0 tty=/dev/pts/0 ruser=ashok rhost= user=ashok
Apr 14 03:04:47 otzivio-ubuntu-s-1vcpu-1gb-intel-fra1-01 sudo[11492]: pam_unix(sudo:auth):
conversation failed
Apr 14 03:04:47 otzivio-ubuntu-s-1vcpu-1gb-intel-fra1-01 sudo[11492]: pam_unix(sudo:auth): auth could
not identify password for [ashok]
Apr 14 03:05:20 otzivio-ubuntu-s-1vcpu-1gb-intel-fra1-01 sudo[11748]: pam_unix(sudo:auth):
authentication failure; logname=ashok uid=1000 euid=0 tty=/dev/pts/0 ruser=ashok rhost= user=ashok
Any help is appreciated
First run " sudo apt-get install -f" for resolve dependences, if it doesn't works, review your config files, permission, etc. Try to see if thare is any update that happened.
In the last case, when nothing works. Try to reinstall by "sudo apt-get autoremove mysql-server && apt-get install mysql-server" but make sure you have all backups os config files and sql...
I don't know if it will really help, but in my job we receve some updates in the server from night to the day that pull all down kkk. After some bad experiences i create the backup of the backp of the backup daily...

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.

MySQL can't connect Ubuntu

Can't connect to MySQL service. Below is the status output error I get when trying to start
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
ruan#master.danzlive.com:~$ systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) since Tue 2018-10-30 11:59:35 SAST; 1s ago
Process: 1988 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 1998 (mysqld); Control PID: 1999 (mysql-systemd-s)
Tasks: 16 (limit: 19660)
Memory: 130.2M
CPU: 577ms
CGroup: /system.slice/mysql.service
├─1998 /usr/sbin/mysqld
└─control
├─1999 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─2031 sleep 1
Oct 30 11:59:35 ip-197-101-38-62 systemd[1]: Starting MySQL Community Server...
ruan#master.danzlive.com:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I faced similar Issue in Ubuntu 18.04. I found the reason that - On last day I cleared Ubuntu using Stacer Application. This application removed mysql log folder at location
/var/log/
So next day while starting MySQL, got this error.
I created that folder again and given permissions.
mkdir /var/log/mysql
sudo chown mysql:mysql -R /var/log/mysql
Try to add the database-username using the -u parameter directly via commandline.
mysql -u root <database>

MySQL 5.7 Upgrade error on Ubuntu 16.04

I was just uninstalling nginx and then in that apt-get remove command, I see that mysql-server is updating. Then the update hung up. I killed the "apt-get" process (followed some answer somewhere). Then things kept on happening and the mysql was completely screwed up. I followed #jargonjunkie 's answer here: https://askubuntu.com/questions/763534/cannot-reinstall-mysql-server-after-its-purge also but to no avail.
(I have even removed /var/lib/mysql and /etc/mysql).
Here's what happens when I try to start mysql:
root#lamp-512mb-nyc1-01:~/etc/mysql# sudo /etc/init.d/mysql start
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
failed!
Here's what "systemctl status mysql.service" shows:
root#lamp-512mb-nyc1-01:~/etc/mysql# systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Tue 2017-10-24 13:40:38 UTC; 13s ago
Process: 21324 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 21315 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 21324 (code=exited, status=1/FAILURE); : 21325 (mysql-systemd-s)
Tasks: 2
Memory: 18.2M
CPU: 423ms
CGroup: /system.slice/mysql.service
└─control
├─21325 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─21357 sleep 1
Oct 24 13:40:38 lamp-512mb-nyc1-01 systemd[1]: Starting MySQL Community Server...
Oct 24 13:40:38 lamp-512mb-nyc1-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
I have seen several questions related to mysql-server 5.7 upgrade on ubuntu, but couldn't find anything that worked.
Please help. Thanks in advance.
Save your data (/var/lib/mysql) and totally remove MySQL:
apt purge mysql* mariadb*
Remove files files from /var/lib/mysql, /etc/mysql, /lib/systemd/system/mysql.service, /usr/share/mysql
Install MySQL again
Check if it starts
Bring data back (if needed)
Check logs journalctl -xe