skip to Main Content

i need some help editing the correct file. I like to add “skip-name-resolve=1” to the my.cnf file. I am using centos7 and mariadb 10.5.

I found a file in /etc/my.cnf. This is the content:

[mysqld]
bind-address = ::ffff:127.0.0.1
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

I struggle with the last line “!includedir /etc/my.cnf.d” and the excamation mark.
in the folder my.cnf.d i have these files:

-rw-r--r-- 1 root root  295 Nov  2 12:37 client.cnf
-rw-r--r-- 1 root root  763 Nov  2 12:37 enable_encryption.preset
-rw-r--r-- 1 root root  232 Nov  2 12:37 mysql-clients.cnf
-rw-r--r-- 1 root root  157 Nov  1 21:13 plesk-utf8mb4.cnf
-rw-r--r-- 1 root root 1080 Nov  2 12:37 server.cnf
-rw-r--r-- 1 root root  120 Nov  2 12:37 spider.cnf

Did i need to add “skip-name-resolve=1” to the server.cnf because this file is inside the includedir? Or did i need to add it to my.cnf after the line socket=…?

Because in server.cnf there is [mysqld] too.

#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.5]

2

Answers


  1. 1.ps -ef|grep mysql
    You can view the my.cnf file in use now.
    2. Stop the database service and add parameters to vi my.cnf.
    skip-name-resolve
    3. Start the database for testing.

    Login or Signup to reply.
  2. For the sake of organization, put it in the server.cnf file.

    Configuration files are read in a particular order, from /etc/my.cnf down to your user ~/.my.cnf. See this MariaDB doc for the current order for your operating system. MySQL/MariaDB will read the last value set when it reads these configuration files in order.

    The files under the includedir are read in alphabetical order.

    You can also print the configuration values to see what is being set by your set of configuration files.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search