Alan Alan - 1 month ago 6x
MySQL Question

Cannot access MYSQL using inline password

I cant connect to mysql if I do this:

mysql -ualan -psecret

It returns:

ERROR 1045 (28000): Access denied for user 'alan'@'localhost' (using password: YES)

But if I do:

mysql -ualan -p

And then I enter the password it works.

I NEED to use the inline password since I'm writing a script to synchronize databases with Laravel/Envoy and it doesnt allow prompt inputs.

Am I missing some configuration or something?


If your password has special characters in your shell, you would need to quote or escape them.

In bash or bash-like shells, this should work:

mysql -ualan -p'te$t'


mysql -ualan -pte\$t