1

I have a new MBP with Yosemite. I have installed the latest version of MySQL (5.6.21 via the pkg file) and have successfully set up its password and see it through Sequel Pro. However, I cannot login to mysqladmin. Normally, like with Ubuntu, I can do:

 mysqladmin -u root -p

But terminal dumps me to the helpful help file. Of course, the rules haven't changed. The help file confirms that if I leave off the password after the -p argument that the TTY will take over but it does not.

 mysqladmin -u root --password 

yields the same help message.

 mysqladmin -u root -password 'password'

asks for a password expected BUT when I pass it then yields unknown command 'password'.

I did do the /usr/local/bin/mysql_secure_installation script but didn't change any values. If my root password has changed why would I still be able to connect via sequel pro and other PHP connections?

I'm sure it's something I'm overlooking but appreciate is there's something I've not found in my Google searches, thanx, sam

2

The program mysqladmin is not an interactive client. It is a client-based utility. mysqladmin allows you run connect to mysqld, run a single command from a specific set of commands, and then, disconnect.

EXAMPLE #1

Some commands that can be done in the mysql client can be done in mysqladmin.

mysqladmin -uroot -ppassword flush-hosts
mysqladmin -uroot -ppassword processlist

EXAMPLE #2

Some commands that cannot be done in the mysql client can be done in mysqladmin.

For instance, an orderly shutdown of mysqld can be done like this:

mysqladmin -uroot -ppassword shutdown

Of course, service mysql stop will work as well. Unfortunately, service mysql stop does not work when the socket file is gone. This can sometimes happen when a person issues service mysql start with mysqld already running. That deletes the socket file. Running mysqladmin -uroot -ppassword shutdown requires the socket file because you are connecting as root@localhost. If you have the user root@127.0.0.1 defined, you can still issue an orderly shutdown by connecting via TCP/IP with mysqladmin like this

mysqladmin -uroot -ppassword -h127.0.0.1 --protocol=tcp shutdown

I have many posts about this such as these

With regard to your original quesiton, if you want to test the password, you should be using mysql, not mysqladmin. You should do this

mysql -uroot -p

As an alternative, if you still want to use mysqladmin, do this

mysqladmin -uroot -ppassword ping

Give it a Try !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.