各种报错解决集合
创建于: 2016-11-19   最后更新: 2018-04-20
疑难杂症

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

A:

sudo chown -R _mysql:mysql /usr/local/var/mysql      
sudo mysql.server start

Q: /usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'bundler' (>= 0.a) among 16 total gem(s) (Gem::LoadError)

A:

gem uninstall bundler
gem install bundler  # don't run with 'sudo'

Q: ERROR 2003 (HY000) Can't connect to MySQL server on 'xxx.xxx' (61)

A:

1.Check if your mysql server is listening on a socket with netstat:

netstat -tulpen

and search for 3306.

2.not or if only on localhost, check my.cnf(vi /etc/mysql/mysql.conf.d/mysqld.cnf) and search the bind-address line and change it to:

bind-address = 0.0.0.0

3.restart mysql:

/etc/init.d/mysql restart