How to reload MySQL's my.cnf?

Server version: CentOS Linux release 7.4.1708 (Core)
MySQL version: 5.7.21
-Source Code installation

$ mysql
ERROR 2002 (HY000): Can"t connect to local MySQL server through socket "/u01/my3306/mysql.sock" (2)

this is an error I reported when I logged in to MySQL. Because when I was in cmake, I configured it like this

-DMYSQL_UNIX_ADDR=/u01/my3306/run/mysql.sock

and then on my.cnf, I wrote this again

socket=/u01/my3306/mysql.sock

I did it when I initialized mysql when I loaded the my.cnf file

mysqld --defauts-file=/u01/my3306/my.cnf --datadir=xxx --initialize-insecure --user=xxx --console

I can"t log in to MySQL right now. If I want to reload the my.cnf, I have to close the MySQL and delete the contents that initialize the MySQL before I can reload it? Is there another way to reload my.cnf?

Mar.04,2021

this problem can be solved by establishing a soft connection through ln-s, but it is not clear how to reload my.cnf


cannot reload my.cnf, unless you restart mysql,
only a limited number of variables can be connected to mysql and modified. Most of them cannot be modified after startup.

Menu