[英]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 我有一个ec2实例,但是当我运行mysql时,它给了我这个错误
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. 我在ec2实例上遇到了同样的问题。 These instructions worked perfectly for me: 这些说明非常适合我:
Redhat Enterprise Linux - RHEL 5 / 6 MySQL installation Redhat Enterprise Linux-RHEL 5/6 MySQL安装
Type the following command as root user: 以root用户身份键入以下命令:
yum install mysql-server mysql
Redhat Enterprise Linux - RHEL 4/3 MySQL installation Redhat Enterprise Linux-RHEL 4/3 MySQL安装
Type the following command as root user: 以root用户身份键入以下命令:
up2date mysql-server mysql
Start MySQL Service 启动MySQL服务
To start the mysql server type the following command: 要启动mysql服务器,输入以下命令:
chkconfig mysqld on
/etc/init.d/mysqld start
Setup the mysql root password 设置mysql root密码
Type the following command to setup a password for root user: 键入以下命令为root用户设置密码:
mysqladmin -u root password NEWPASSWORD
Test the mysql connectivity 测试mysql连接
Type the following command to connect to MySQL server: 键入以下命令以连接到MySQL服务器:
$ 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. 如果没有返回任何内容,则说明MySQL未运行。
Troubleshoot by adding the following to the config file: log_error=/path/to/logfile
通过将以下内容添加到配置文件来进行故障排除: log_error=/path/to/logfile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.