Showing posts with label mysql_secure_installation. Show all posts
Showing posts with label mysql_secure_installation. Show all posts

Saturday, November 1, 2014

mysql_secure_installation : ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Overview 

This is about
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Solution

I installed mysql 5.5.40 using a tarball on a non standard location

One the software installed and the instance created/started I wanted to secure it using mysql_secure_installation.

If you are not using the default socket /tmp/mysql.sock mysql_secure_installation won't work and you will get the following error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

In order to fix the issue, there is a simple solution :

1. create a soft link in /tmp for your socket
EX: ln -s /mysql/admin/mysql1/socket/mysql1.sock /tmp/mysql.sock

2. run your mysql_secure_installation

3. once completed remove the soft link
rm -f /tmp/mysql.sock

Problem fixed

Sunday, February 16, 2014

How to implement basic security on your MySQL instance

Overview

The first things you should do when installing MySQL is to secure your installation.

Secure your MySQL installation

Here are few step to perform basic security on your MySQL instance
  • Once you install your MySQL you should run mysql_secure_installation
  • You should change the default port by ediiting my.cnf and change the port number. Default port number is 3306. to change the port number in MySQL, add port=new_port_number in the [mysqld] section in /etc/my.cnf then restart you MySQL after the change.
  • Once this is done you can start your mysql. then you should change the root password 
    • mysqladmin -u root password your_new_password