Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql: unknown variable, can't run any mysql applications, doesn't seem to be to do with 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

like image 639
Matt Fletcher Avatar asked Apr 25 '12 18:04

Matt Fletcher


2 Answers

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.

like image 127
johnshen64 Avatar answered Oct 13 '22 23:10

johnshen64


Error : mysql: unknown variable '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.

like image 24
Rudra Avatar answered Oct 14 '22 01:10

Rudra