mysql安装程序是未知文件,MySQL:未知变量,无法运行任何MySQL应用程序,与my.cnf无关...

My problem is that, when trying to run MYSQL on Fedora, I am faced with the following error:

mysql: unknown variable 'max_connections=40'

It does the exact same thing for any other of the commands, such as mysqldump, mysqlcheck etc etc

The my.cnf file reads the following, though I've renamed it and the error still occurs. It almost seems like it's a system variable that I am unable to edit without running mysql, thus the catch 22!

[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

I've also of course checked the system for any other my.cnf files.

I'm really lost and starting to tear my hair out. Any help would be greatly appreciated! :)

Thanks

Matt

解决方案

assuming that your good configuration file is /etc/my.cnf (which may not be), edit your mysql init file and add --init-file /etc/my.cnf to the mysqld command to make sure that it is indeed reading from the the init file that you think it is reading from.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
官方MySQL Docker镜像是一个非常方便的工具,可以快速地部署MySQL数据库。默认情况下,官方MySQL Docker镜像中包含的MySQL服务器配置是在启动容器时使用环境变量进行动态调整的。这通常能够满足大多数情况,但在有些情况下,我们可能需要对MySQL服务器进行更加详细的配置,这时我们就需要使用自定义的配置文件my.cnf。 自定义配置文件my.cnf可以包含MySQL服务器的各种配置选项,例如缓存、日志、安全、性能调优等。我们可以根据自己的需求定义这些选项,并将my.cnf复制到Docker容器中。在启动容器时,我们使用-v选项将我们自定义的my.cnf文件映射到容器内的/etc/mysql/my.cnf路径,覆盖默认配置文件。 一个简单的例子,在本地新建一个my.cnf文件,并添加以下代码: [mysqld] innodb_buffer_pool_size=2G 然后使用docker run命令启动MySQL容器: docker run --name some-mysql -v /path/to/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag 请确保/my.cnf文件所在的主机路径(path/to/my.cnf)已经存在,否则容器将无法启动。 以上就是使用自定义配置文件my.cnf的基础内容。但需要注意的是,在自定义配置文件中,我们不应该使用与容器所在主机或网络环境不一致的IP地址或主机名,否则可能导致MySQL服务器无法正常运行。最好使用通用的IP地址(0.0.0.0)或者localhost。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值