Linux Mysql:未知变量,无法运行任何mysql应用程序,似乎与my.cnf无关
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10321800/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mysql: unknown variable, can't run any mysql applications, doesn't seems to be to do with my.cnf
提问by Matt Fletcher
My problem is that, when trying to run MYSQL on Fedora, I am faced with the following error:
我的问题是,当尝试在 Fedora 上运行 MYSQL 时,我遇到了以下错误:
mysql: unknown variable 'max_connections=40'
mysql:未知变量“max_connections=40”
It does the exact same thing for any other of the commands, such as mysqldump, mysqlcheck etc etc
它对任何其他命令执行完全相同的操作,例如 mysqldump、mysqlcheck 等
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!
my.cnf 文件读取以下内容,但我已将其重命名并且错误仍然发生。它几乎似乎是一个系统变量,如果不运行 mysql,我将无法对其进行编辑,因此 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.
我当然也检查了系统是否有任何其他 my.cnf 文件。
I'm really lost and starting to tear my hair out. Any help would be greatly appreciated! :)
我真的很迷茫,开始把头发扯掉。任何帮助将不胜感激!:)
Thanks
谢谢
Matt
马特
采纳答案by johnshen64
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.
假设您好的配置文件是 /etc/my.cnf(可能不是),编辑您的 mysql init 文件并将 --init-file /etc/my.cnf 添加到 mysqld 命令以确保它确实在读取来自您认为它正在读取的 init 文件。
回答by Rudra
Error : mysql: unknown variable 'max_connections=**'
错误:mysql:未知变量“max_connections=**”
One of the reasons this occurred was that max_connections parameter was updated under [mysql] section , we were able to log in after we added that under [mysqld] section.
发生这种情况的原因之一是在 [mysql] 部分下更新了 max_connections 参数,在 [mysqld] 部分下添加该参数后,我们能够登录。