Task: After digging the issue team found that mariadb is down on the database server. Fix the issue.
Solution:
Login to database server:
ssh peter@stdb01
Login as root:
sudo su
Install mysql:
yum install mysql
Start mariadb and check status:
systemctl start mariadb
systemctl status mariadb
Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here
Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here
Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here
I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More:
Click Here
It worked. But how to figure out the issue ? I mean how u know mysql is not installed?
ReplyDeleteYou can check the status at first by this command systemctl status mariadb. Then you can find the issue.
DeleteHi, thanks for the solution. I executed the command systemctl status mariadb, but I didn't find the problem with mysql. I searched how install mariadb, but the one reference that i am found was this:
ReplyDeletesudo mysql_secure_installation
I tried with your steps by steps and it solutionated.
This line "yum install mysql" why is necessary?
Sorry I am not too experience in linux.
Because the existing mysql service is corrupted. That's why you need to re install or update it.
Deletethanks @ASHADULLAH SHAWON
ReplyDeleteNo need to install anything
ReplyDeleteJust locate mysql files, in /usr/bin/ & /etc/ & /var/lib . And then change the ownership of the files to chown mysql:mysql . And then start the service. service mariadb start. It will start successfully.
journalctl -xe | grep mariadb
ReplyDeleteChange ownership of mysql.
chown -R mysql:mysql /var/lib/mysql
systemctl enable mariadb
sytemctl start mariadb
systemctl status mariadb
Thanks a lot. I did everything but Icouldnt be success."chown -R mysql:mysql /var/lib/mysql"this command provided success for me..
DeleteInteresting you guys. Thanks for all the contributions
ReplyDeleteI just installed mysql using yum.
ReplyDeleteStarted and enabled the mariadb service and it worked for me. Thanks Shawonruet
the answer varies.
ReplyDeletefor some the below works
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl start mariadb.servic
This worked for me Thanks Buddy
Delete