When I am invoking the file mysql_secure_installation
I get an error like
[mysqk123@InstallZeMo bin]$ ./mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Enter current password for root (enter for none):
but the given sock file in my.cnf file is /home/mysqk123/tmp/mysql.sock and I am using redhat linux 5.3 and mysql 5.1.47
I know that the tasks performed by mysql_secure_installation script can be performed manually but here I have to run the script [ not allowed to do the task manually ]
Since this utility is meant to be used over a standard installation, and because it seems to accept no parameter, I see very few options:
mysql_secure_installation
so that it uses your custom location. If I understand it correctly, the script creates a temporary configuration file as ./.my.cnf.$$
($$
is the pid) around line 46 in the make_config
subroutine.Modify as follows: (disclaimer: not tested :)
make_config() {
echo "# mysql_secure_installation config file" >$config
echo "[mysql]" >>$config
echo "user=root" >>$config
echo "password='$rootpass'" >>$config
# add the line below
echo "socket=/home/mysqk123/tmp/mysql.sock" >>$config
}
Again, this script is meant to be used on a standard, out-of-the box installation. Tell your boss (or your client) that if you were able to configure MySQL to use a non-standard socket location, you are also able to run by hand simple commands such as deleting accounts and setting passwords.
Make sure you start mysql or mariadb, for example:
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With