Bug #75557 mysql_secure_installation does not work with non default socket
Submitted: 19 Jan 2015 16:59 Modified: 20 Jan 2015 7:38
Reporter: Oli Sennhauser Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.22 OS:Linux
Assigned to: CPU Architecture:Any
Tags: mysql_secure_installation, socket

[19 Jan 2015 16:59] Oli Sennhauser
Description:
mysql_secure_installation does not work with non default socket

How to repeat:
Our actual mysql process: /home/mysql/product/mysql-5.6.22/bin/mysqld ... --socket=/tmp/mysql-35622.sock

Preparation:
env | grep -i unix
MYSQL_UNIX_PORT=/tmp/mysql-35622.sock
unset MYSQL_UNIX_PORT

Repeat:
mysql_secure_installation --user=root
Enter current password for root (enter for none): 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

mysql_secure_installation --user=root --socket=/tmp/mysql-35622.sock
Enter current password for root (enter for none): 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

mysql_secure_installation --help
--> not even this standard mysql/linux behaviour works in some ways. Should write another feature request about this...

Workaround:
1.) ln -s /tmp/mysql-35622.sock /tmp/mysql.sock
2.) export MYSQL_UNIX_PORT=/tmp/mysql-35622.sock

Suggested fix:
1. mysql_secure_installation should consider --socket option
2. mysql_secure_installation should provide usage with --help
[20 Jan 2015 7:38] MySQL Verification Team
Hello Oli Sennhauser,

Thank you for th ereport.
Imho this is duplicate of existing bug report Bug #46842

Also, with latest trunk 5.7.6:

[uhastry@ushastry]/export/umesh/mysql-5.7.6: bin/mysql_secure_installation --help |grep socket
  --protocol=name     The protocol to use for connection (tcp, socket, pipe,
  -S, --socket=name   Socket file to be used for connection.
socket                            (No default value)

Thanks,
Umesh
[20 Jan 2015 7:45] MySQL Verification Team
// Confirmed that it works with non default socket

[ushastry@ushastry]/export/umesh/mysql-5.7.6: bin/mysql_secure_installation -uroot -p --socket=run/mysql.sock
Enter password:

Securing the MySQL server deployment.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file