Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

0 votes
by (19.1k points)

I'm trying to access mysql and when I run the mysql command, I get the following.

[root@ip-10-229-65-166 tpdatabase-]# mysql

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

Doing this returns nothing

[root@ip-10-229-65-166 mysqld]# find -name mysql*

[root@ip-10-229-65-166 mysqld]# /etc/init.d/mysql stop -bash: /etc/init.d/mysql: No such file or directory

[root@ip-10-229-65-173 tpdatabase-]# mysql_config |grep -- --socket

--socket [/var/lib/mysql/mysql.sock]

Maybe a permissions problem?

I do have mysql installed using yum install mysql

I'm running CentOS 5.4 on an Amazon EC2 Cloud Instance

1 Answer

0 votes
by (44.4k points)

Have to do two steps, First install MySQL server package and then start the service

Step 1:

sudo yum install mysql-server

Step 2:

sudo service mysqld start


Browse Categories