mysql: Unknown variable 'key_buffer=16M'

Asked

Viewed 2,266 times

1

On Linux, through the command line, when I try to accomplish login with:

mysql -u root -p

Should receive the prompt:

Enter password:

But instead I get the mistake:

mysql: unknown variable 'key_buffer=16M'

Where this error originates from and how can I fix it?

If relevant the server runs Ubuntu precise (12.04.1 LTS) with Mysql 5.5.37.

  • You inserted this directive key_buffer somewhere in the Mysql configuration? It seems to me = should be with spaces around.

  • See if this "key_buffer=16M" is in /etc/my.cnf

  • @Andréribeiro Is in /etc/mysql/my.cnf written as follows: key_buffer = 16M


  • Comment on the line that will solve your problem

  • @Andréribeiro will resolve and shut down the buffer. I have this line in my configuration (including increased value for performance reasons), and never gave this error.

  • 2

    @bfavaretto Will actually reset to the default value (8mb) which is quite low.

  • @Zuul try switching to key_buffer_size and see if it works.

  • @Andréribeiro Yes, that was the solution. I am responding with what I have been able to ascertain in the course of the process, but if you can answer with that indication, I would be grateful!

Show 3 more comments

2 answers

3

In addition to the tip/solution presented by @Andréribeiro, after some tests, I was able to observe that:

Ascertain locations of my.cnf

There is no method to find where the file is my.cnf, but the common locations are:

/etc/my.cnf
/etc/mysql/my.cnf          (no meu caso estava aqui)
$MYSQL_HOME/my.cnf
[datadir]/my.cnf
~/.my.cnf

Source: https://stackoverflow.com/a/2485758/352449

Determine correct variable name

Effectively, not knowing whether the variable was correct or not, and given the error itself suggest that the variable is unknown, through the phpMyAdmin I executed the following command:

SHOW VARIABLES LIKE '%key_buffer%';

Having obtained variable name key_buffer_size with the value 8388608.

Source: https://serverfault.com/a/550748/128973

Documentation

In more detail, the documentation refers to key_buffer_size, a little strange because the my.cnf on this and other servers is with key_buffer. I assume that this is some change of Mysql, with the my.cnf outdated.


The problem was overcome by changing the name of key_buffer for key_buffer_size.

0

Go on /etc/my.cnf, search for "key_buffer" and comment on the line. Try again and you will see that it will work.

If so, go to the (s) line(s) above your "key_buffer" and see if there is something misspelled.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.