Posts

Showing posts from September, 2015

How to restart mysql server through SSH

CentOS/RHEL/Fedora/Scientific Linux version 4.x/5.x/6.x or older users The syntax is: ### To start ### service mysqld start # OR /etc/init.d/mysqld start   ### To stop ### service mysqld stop # OR /etc/init.d/mysqld stop   ### To restart ### service mysqld restart # OR /etc/init.d/mysqld restart   CentOS/RHEL/Fedora/Scientific Linux version 7.x or newer users The syntax is as follows to start mariadb/mysql server: ## mariadb ## systemctl start mariadb ## mysql systemctl start mysqld The syntax is as follows to stop mariadb/mysql server: ## mariadb ## systemctl stop mariadb ## mysql systemctl stop mysqld The syntax is as follows to restart mariadb/mysql server: ## mariadb ## systemctl restart mariadb ## mysql systemctl restart mysqld Debian/Ubuntu Linux users The syntax is as follows to start/stop/restart mysql server: #### To start #### /etc/init.d/mysql start # OR service mysql start   #### To stop #### /etc/init.d/mysql stop # OR service mysql stop   #### To restart #### /etc/init…

How to restore mysql Database from cpmove file through SSH

I have been asked a few times how to extract the mysql databases from cpmove cPanel files without extracting the full tar. tar -zxf navicosoftahostingcompany.tar.gz navicosoftahostingcompany/mysql;mysql navicosoftahostingcompanydb < navicosoftahostingcompany/mysql/navicosoftahostingcompanydb.sqlIf you want to create a for loop for achieving mysql databases from cpmove files, please use the following script to do so: for a in *;do filenamewithonedot="${a%.*}";filename="${filenamewithonedot%.*}"; tar -zxf $a $filename/mysql;mv $filename/mysql/*.* /home/abubakarsql/mysql --force;echo $filename;done;

wget: command not found

Is wget installed?

CODE: SELECT ALLrpm -q wget
wget-1.10.2-7.el5

If not, install it:

CODE: SELECT ALLyum install wget

What to do after I deleted /var/lib/mysql on a cpanel server

Restoring /var/lib/mysql can be done by putting back a backup. If you did not have a backup, you've lost your database. The only thing that can be done is reinstalling the MySQL server: Re Installation of MYSQL On Cpanel Servers:

Run the following command to find the SQL rpms that were installed on your server:

rpm -qa | grep -i sql

2) Remove the necessary MySQL rpms uisng yum.

Example: yum remove MySQL55-shared-5.5.30-3.cp1136.x86_64 MySQL55-client-5.5.30-3.cp1136.x86_64 MySQL55-devel-5.5.30-3.cp1136.x86_64 MySQL55-test-5.5.30-3.cp1136.x86_64

3) Then delete the MySQL PID file(s) using this command:

rm -f /var/lib/mysql/*.pid

4) Finally run following script to install the cPanel compatible MySQL rpms:

/scripts/check_cpanel_rpms --fix

How to a ClamAV and Maldet scan on cPanel servers

Running a ClamAV and Maldet scan on cPanel servers You may be familiar with ClamAV and Maldet (aka Linux Malware Detect). They're widely known as two excellent choices for identifying malware. What you may not realize, however, is that they can be used together. The benefit of doing this is a faster, more effective malware scan meaning you're more likely to identify potential threats. 

This tutorial is based around cPanel systems, and will require changes on other platforms.

Installing ClamAV via WHM
1) Login to WHM (Web Host Manager) as the root user
2) Navigate to: Home » cPanel » Manage Plugins
3) Tick the Install and keep updated box
4) Click on Save
Installing ClamAV via SSH
This command tells the system that we want ClamAV to be listed as installed by the local RPM system:
/scripts/update_local_rpm_versions --edit target_settings.clamav installed
This command is the one responsible for installing the ClamAV RPM on your server:
/scripts/check_cpanel_rpms --fix --targets=clamav

Inst…