mysql bind-address选项_为什么我在mysql的my.cnf下找不到bind-address?

1.描述:

我在ubuntu16.04LTS上按照这个教程http://os.51cto.com/art/20130…装了LAMP,然而在配置MySQL的时候想确认在MySQL的my.cnf文件中是否有正确的绑定地址时出现了以下错误:

当我输入:

cat /etc/mysql/my.cnf | grep bind-address

出现了:

sylvia@sylvia-Aspire-E5-572G:~$ cat /etc/mysql/my.cnf | grep bind-address

sylvia@sylvia-Aspire-E5-572G:~$

(并没有找到bind-address的错误)

然后我打开/etc/mysql/my.cnf查看发现:

#

# The MySQL database server configuration file.

#

# You can copy this to one of:

# - "/etc/mysql/my.cnf" to set global options,

# - "~/.my.cnf" to set user-specific options.

#

# One can use all long options that the program supports.

# Run program with --help to get a list of available options and with

# --print-defaults to see which it would actually understand and use.

#

# For explanations see

# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#

# * IMPORTANT: Additional settings that can override those from this file!

#   The files must end with '.cnf', otherwise they'll be ignored.

#

!includedir /etc/mysql/conf.d/

!includedir /etc/mysql/mysql.conf.d/

2.问题:

是因为我没有配置my.cnf文件吗?

(但是那个教程里并没有要求配置啊)

如果不是,那是为什么会这样?

如果是,那我应该怎样配置?(网上的配置教程看得我一脸蒙逼)

各位dalao。。原谅我问这么小白菜的问题。。。

如果能帮我解决,我将万分感谢!

你的配置文件在这两个目录里:

/etc/mysql/conf.d/

/etc/mysql/mysql.conf.d/

找一些比较适合你的系统的新一些的教程,比如:

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04

是这样的,你可以自己 写一份 /etc/mysql/my.cnf 放在那。

mysql --help | grep my.cnf

可以显示mysql配置文件的读取顺序。

Linux

上面很多新版本的软件都将配置文件分割了,这已经是一种风格了,比如说环境变量配置文件

/etc/profile

就有扩展配置文件夹

/etc/profile.d

,apache也是,除了主配置文件

httpd.conf

之外,

http.conf

include

conf.d

(不知道有没有记错)目录下面的所有以

conf

结尾的文件,所以你看到配置文件中的

include

,你就需要明白是什么意思!

最后,请觉得理解了也选个答案,别知道了答案也挂着未解答

1、使用find、locate等命令,查找所有的my.cnf文件。如果存在多个my.cnf,有一些是没有加载的,只有一个是加载的。

2、如果真正的my.cnf文件没有bind address,是你的my.cnf没有写,相当于注释掉了,你可以自己写上,然后重启mysql。


版权声明:本文为weixin_36070568原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。