您的位置:首页 > 数据库 > MySQL

mysql错误2002的解决办法 ERROR 2002 (HY000) mysql.sock(2)

2016-03-22 21:25 821 查看

mysql安装错误ERROR 2002 (HY000)解决办法

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

问题解决过程,执行以下命令,看提示信息
#/usr/bin/mysql_install_db


Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h controller password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!


执行
#/usr/bin/mysqld_safe &
执行完成MySQL2002错误就没有了,接着简单设置MySQL密码
#/usr/bin/mysqladmin -u root password 'new-password'
高级设置
Alternatively you can run:
#/usr/bin/mysql_secure_installation


重启MySQL服务,现在可以用密码登录MySQL,而不会出现error 2002了。

虽然不知道具体的错误原因,但是以上办法的确可以决解问题。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: