Home  >  Q&A  >  body text

MySQL server cannot apply modifications in my.cnf file

I have installed mysql server and mysql client using bundles on Centos 7. The port of mysql server is shown as 0. I want to assign it a specific port. To this end, I have modified /etc/my.cnf as follows:

port=4545

After modification, I restarted the service. But it skips network settings when starting up and the status is ON. I also tried changing skip-networking to OFF without success.

After the change, I also tried mysql_secure_installation but got the following error:

fail! Error: The MySQL server is running with the --skip-grant-tables option and therefore cannot execute this statement

How can I solve this problem? Thank you for your answer

P粉092778585P粉092778585429 days ago509

reply all(1)I'll reply

  • P粉957723124

    P粉9577231242023-09-07 12:05:56

    I have solved my problem by:

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

    After this, I restarted the service.

    systemctl start mysqld

    reply
    0
  • Cancelreply