Megha Sharma
Megha Sharma

Reputation: 2255

Bind Address missing in my.cnf in MYSQL centos

I have hit a problem, when I edit the my.cnf for MySQL, the bind-address line is not in the file.

Here is the content of /etc/mysql/my.cnf:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

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

Kindly help me to achieve this.

Upvotes: 8

Views: 30800

Answers (1)

mdh.heydari
mdh.heydari

Reputation: 540

Just add these lines to mysqld section depending on your preferences:

  1. If you want it to only be accessible through localhost:

    bind-address=127.0.0.1

  2. If you want it to be accessible through an interface which assigned an IP address of XXX.YYYY.WWW.ZZZZ:

    bind-address=XXX.YYYY.WWW.ZZZZ

  3. If you want it to be accessible through all interfaces available, This is not recommended except when you properly configured your firewall for it:

    bind-address=0.0.0.0

Upvotes: 6

Related Questions