1

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?

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Alan
  • 2,559
  • 4
  • 32
  • 53

1 Answers1

2

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'

Or

mysql -ualan -pte\$t
Alexander O'Mara
  • 58,688
  • 18
  • 163
  • 171