【问题标题】:Where can I find mysql config file with all parameters?我在哪里可以找到所有参数的 mysql 配置文件?
【发布时间】:2020-10-03 10:15:24
【问题描述】:

在哪里可以找到包含所有参数的 mysql 配置文件? 我在

中找到了一些配置文件

/etc/mysql/

目录,但没有包含所有参数的文件!

其实我想远程访问我机器的mysql服务器。所以我在文件中找到了“bind-address”参数,但没有一个文件包含所有参数! 这些是我在这个目录中找到的文件:

./conf.d 
./conf.d/mysql.cnf 
./conf.d/mysqldump.cnf 
./debian-start 
./debian.cnf 
./mariadb.cnf 
./mariadb.conf.d 
./mariadb.conf.d/50-client.cnf 
./mariadb.conf.d/50-mysql-clients.cnf 
./mariadb.conf.d/50-mysqld_safe.cnf 
./mariadb.conf.d/50-server.cnf 
./my.cnf.fallback 
./my.cnf

我读了一些文章说 my.cnf 是 mysql 配置文件,但没有绑定地址或任何这是 my.cnf 文件的输出。

# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# 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.

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

mysql版本: mysql Ver 15.1 Distrib 10.3.22-MariaDB,用于 debian-linux-gnu (x86_64) 使用 readline 5.2

机器名称和版本:

1. Linux parrot 5.6.0-2parrot1-amd64 #1 SMP Debian 5.6.14-2parrot1 (2020-05-23) x86_64 GNU/Linux

2. Linux ubuntu-VirtualBox 4.15.0-106-generic #107~16.04.1-Ubuntu SMP Thu Jun 4 15:39:45 UTC 2020 i686 i686 i686 GNU/Linux

【问题讨论】:

    标签: mysql linux ubuntu configuration mariadb


    【解决方案1】:

    你想要你在my.cnf 或其他文件中的设置吗?

    或者您是否想要所有 500 个左右的设置,包括默认设置,例如 SHOW VARIABLES?

    【讨论】:

    • information_schema.global_variables 应该给出相同的结果。
    【解决方案2】:

    您可以使用以下命令查看 my.cnf 文件的搜索路径:sudo mysqld --help --verbose | grep cnf

    正常的搜索路径是:/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf /.my.cnf

    如果不存在,则创建一个 /etc/my.cnf 文件。

    【讨论】:

    • 是的,我已经尝试在这些目录或文件中创建 my.cnf 文件(如果没有的话)。并尝试在这些文件中附加“bind-address = 0.0.0.0”,但我仍然关闭该端口。 (我知道 0.0.0.0 是有风险的,但我会在我的工作完成后立即更改它)
    • 请检查您的防火墙是否接受来自网络外部的端口 3306 上的连接。使用 Telnet 进行验证。例如:#telnet {db server ip} 3306 或使用此 [telnet-online.net/] 在线检查并且,允许在防火墙中使用 iptables 使用以下命令:# 将规则附加到 INPUT 链的末尾 #sudo iptables -A INPUT -p tcp -m tcp --dport 3306 -d 0.0.0.0 -j ACCEPT
    【解决方案3】:

    试试这样的表格:

    使用性能模式; select * from .global_variables where variable_name in ('bind address','port');

    【讨论】:

    • 它说“错误 1146 (42S02): 表 'performance_schema.global_variables' 不存在”!知道该怎么做吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-19
    • 2011-02-10
    • 2019-12-22
    • 1970-01-01
    • 2015-02-23
    • 1970-01-01
    相关资源
    最近更新 更多