How to escape ! in password?

How might one escape the exclamation point in a password:

$ mysql -umyuser -pone_@&!two
-bash: !two: event not found

Trying the obvious backslash did not help:

$ mysql -umyuser -pone_@&\!two
[1] 22242
-bash: !two: command not found
[email protected] [~]# ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using password: YES)

All my google searches suggest that the backslash would help, but it does not. There is no way to use quotes as suggested in this question. The line will be used in a .bashrc alias. Don't worry, the usernames and passwords shown here are examples only and not used in production!


Use single quotes around the password like this: -p'one_@&!two'

To put it in an alias, you'd do something like:

alias runmysql='mysql -umyuser -p'\''one_@&!two'\'''


-bash: !two: command not found

You also need to escape the & character:

$ mysql -umyuser -pone_@\&\!two