Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 337
Megha Sharma Avatar asked May 15 '14 05:05

Megha Sharma


1 Answers

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

like image 98
mdh.heydari Avatar answered Oct 02 '22 09:10

mdh.heydari