开发者

Starting mysql in new EC2 instance throws "can't connect through socket" error

I have an ec2 instance, but when i run mysql, it gives me this error

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

Similarly, when i run

/etc/init.d/mysql start

Oct 31 11:29:16 domU-12-31-38-00-A8-62 /etc/init.d/mysql开发者_开发知识库[5263]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'

What is wrong?


I had this same problem on an ec2 instance. These instructions worked perfectly for me:


Redhat Enterprise Linux - RHEL 5 / 6 MySQL installation

Type the following command as root user:

yum install mysql-server mysql

Redhat Enterprise Linux - RHEL 4/3 MySQL installation

Type the following command as root user:

up2date mysql-server mysql

Start MySQL Service

To start the mysql server type the following command:

chkconfig mysqld on
/etc/init.d/mysqld start

Setup the mysql root password

Type the following command to setup a password for root user:

mysqladmin -u root password NEWPASSWORD

Test the mysql connectivity

Type the following command to connect to MySQL server:

$ mysql -u root -p


Well, maybe the server is not running? :)

At the bare minimum:

ps aux|grep [m]ysql

If this returns nothing, then MySQL is not running.

Troubleshoot by adding the following to the config file: log_error=/path/to/logfile

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜