MySQL5.6:mysql_secure_installation 报错ERROR 2002 (HY000)

mysql在修改data_dir之后,运行mysql_secure_installation会报如下错误
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

解决方法:
     修改mysql_secure_installation文件,大约150行,在sub make_config定义中加入 "socket=/data/mysql/mysql.sock",修改完成如下
sub make_config {
  my $password = shift;

  my $esc_pass = basic_single_escape($rootpass);
  write_file($config,
             "# mysql_secure_installation config file",
             "[mysql]",
             "user=root",
             "password='$esc_pass'",
             "connect-expired-password",
             "socket=/data/mysql/mysql.sock");
}
MySQL5.6:mysql_secure_installation 报错ERROR 2002 (HY000)_第1张图片

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29757574/viewspace-2137094/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29757574/viewspace-2137094/

你可能感兴趣的:(MySQL5.6:mysql_secure_installation 报错ERROR 2002 (HY000))