32423hjh32423 32423hjh32423 - 1 year ago 82
MySQL Question

Differences in mysql version when passing version attribute

Why does the following happen?

$ mysql --version
mysql Ver 14.14 Distrib 5.7.16, for osx10.11 (x86_64) using EditLine wrapper

$ mysql -v
ERROR 1045 (28000): Access denied for user 'xxx'@'localhost' (using password: NO)

Are there two versions of mysql? How do I get rid of the one that isnt mysql Ver 14.14 Distrib 5.7.16?

Answer Source

I think you are confusing --version and -v. From the MySQL documentation:

Option names are case sensitive. -v and -V are both legal and have different meanings. (They are the corresponding short forms of the --verbose and --version options.)

I think that when you typed mysql -v you tried to start MySQL with some sort of verbose flag turned on. Regardless, you did not specify a username or password. So it tried to use your Linux username with no password, which failed.