MySQL (Percona Server) is not running, but lock file (/var/[FAILED]sys/mysql) exists

In this tutorial i will show you how to fix 'MySQL not running but lock file exists' error

MySQL (Percona Server) is not running, but lock file (/var/[FAILED]sys/mysql) exists

First you need to delete the lock file

rm /var/lock/subsys/mysql

Be sure that there is no multiple MySQL services running, check MySQL processes and kill them Continue reading

Install phpMyAdmin on Centos 7

Install phpMyAdmin on Centos 7

phpMyAdmin is a free web application which will make it easier working with MySQL, it will provide simple backup,restore and other MySQL GUI features, in this tutorial i will show you how to install phpMyAdmin on Centos, download phpMyAdmin, and this can be applies to localhost phpMyAdmin too.

Install phpMyAdmin on Centos 7

In this article i will be installing phpMyAdmin on CentOS 7, this can work on RHEL 7 and other flavors too.

Prerequisites:

Continue reading

MySQL ERROR 1064 (42000) While Restoring a Backup

Getting MySQL ERROR 1064 While Restoring a Backup Which was Created using MySQL

In this post we will be addressing the MySQL error 1064 and show the causes which can lead to this error, usually this error appears when trying to restore a backup and it will be a syntax in the sql which can be fixed manually by editing the sql or going through the below fixes.

Problem:

Getting ERROR 1064 (42000) while restoring a MySQL dump sql file. Continue reading

Find Database Size on MySQL

Determine MySQL Database Size

Determining the size of MySQL database

Determining the size of specific MySQL database can be done in so many way, you can do it from the Linux file system perspective or from MySQL.

The most accurate way to find MySQL database size recommended by Percona is by checking the information_schema and this can be done by running the following query (Replace db_name with the database name you want to investigate) :

Database size in GB:

SELECT table_schema "Database Name", SUM( data_length + index_length)/1024/1024/1024 "Database Size (GB)" FROM information_schema.TABLES where table_schema = 'db_name';

Database size in MB:

SELECT table_schema "Database Name", SUM( data_length + index_length)/1024/1024 "Database Size (MB)" FROM information_schema.TABLES where table_schema = 'db_name';

 

Fixing SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed

Sqlstate error usually happens when there is a problem connecting to the database, you can troubleshoot this by checking the connectivity from the source web-server to the database and the firewall rules if it's on a different server than the web server.

Ping the database

ping server-name

If you are not getting a reply or it's not resolving then maybe you need to check the dns or hosts file to be sure that it's pointed to the right ip

Check the firewall and if the port is opened between both server

nmap -sS -O server_name or IP_Address

Use nmap to check firewall status

You should see something like:

3306/tcp open mysql

Or different ports and service if it's ms-sql, if the port is not there or closed, then you need to open the firewall.