Solving the problem “Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ ”

MySQL server is usually connected by using the following command

mysql      –u      root      –p

some times we may encounter the following the error

can’t connect to local MySQL server through socket /var/lib/mysql/mysql.sock

A socket is used to bridge connection between the server and client.

Error message explains that it is not able to find that socket file.

Socket file is automatically created when we start the MySQL server and disappears automatically when the server is stopped.

This problem most probably arises when you accidentally delete it or if you reinstall same server again or because of server might not be running currently.

Current running state of the server could be known using the following command

service     mysqld     status

Use the following command to solve the issue

sudo     /etc/init.d/mysqld     restart

The above command is used to restart the MySQL server so that the socket file can be created.

Enabling Oracle Linux to listen for requests over the network

Oracle Linux has a default firewall in the name of package “iptables“. This firewall is enabled by default when installed .Without disabling or modifying it we could not access most of the  services provided by the Linux. For example, you may not be able to access your database and tomcat over the network.

We can disable the firewall by following the below procedure :

Firstly we need to install the iptables-services package by using following command –

sudo yum install iptables-services

Next disable the firewall by using following commands:

sudo service iptables start

sudo service iptables stop 

sudo chkconfig iptables off

To punch or block specific ports and for more information , refer to the following link.

Oracle Database Installation – Circumventing the requirement for pdksh package

 

Oracle Database 11G R2 has many packages as dependencies. Amongst such packages is pdksh packages which is no longer a part of yum repositories. The pdksh is not  needed as long as your ksh package is installed. Oracle Linux has ksh installed by default. Trying to install the pdksh using rpm could cause a conflict between these packages.

Problems with pdksh could be easily resolved by modifying the configuration of the verification utility of the oracle database. By default, this utility assumes that the Linux distribution being used is OEL4. All the dependencies were verified considering the OEL4. Changing the value of Linux distribution being used could solve the problem with pdksh. If you are using OEL 6, change the value of Linux distribution OEL6. Similarly if you are using OEL 7 , change the value of Linux distribution to OEL7.

 

Following are the exact instructions regarding the procedure.

 

Let   <db_extract>      be the location of your database extract.

cd   <db_extract>/database/stage/cvu/admin/

vim cvu_config

The following screenshots guide you regarding the same:

 

  1. Navigating to the required directory
    PDKSHNEW1
  2. Default cvu_config

PDKSHNEW2

3.Modified cvu_config

PDKSHNEW3

You should be finding a property named CVU_ASSUME_DISTID whose default value is OEL4

If you are using OEL6 change it to OEL6. If you are using OEL7 change it to OEL7.

Restart the configuration utility and you should not be finding the requirement for pdksh anymore.