'mysql server doesn't recognize changes in my.cnf

I have installed mysql server and mysql client with bundle in Centos 7. mysql server's port is displayed as 0. I want to give specific port to it. For this purpose, I have changed /etc/my.cnf with below;

port=4545

After changes, I've restarted the service. But it's start with skip-networking as ON. I have also tried to change skip-networking to OFF but didn't accomplish.

I have also tried mysql_secure_installation after changes but got below error :

Failed! Error: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

How can i solve this? Thanks for answering



Solution 1:[1]

I have solved my question with below;

systemctl stop mysqld
systemctl daemon-reload
systemctl set-environment MYSQLD_OPTS="--skip-networking=OFF"

After this I have started service again.

systemctl start mysqld

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Orkun