MySQL password problem

By jimmy-jam ·
Can you help me crack the root password? Ha! Kidding

Seriously though, I am having an issue with logging into MySQL form the command line as root. The problem is my password follows this pattern !password! this is a shop standard password. The problem is when I run the following command.

#mysql -uroot -p!password!

Linux returns "-bash: !password!: event not found

Obviously the ! is being read as something other than a character in the password. If I just run the following.


it doesn't log me in as the root user it logs me in with a blank username. Is there any way I can pass the ! when I log in?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

is this...

by m61 In reply to MySQL password problem

...being run on windows or linux? i know linux [may] have issues with the ! character, so try placing a \ in front of each ! to escape it. not sure how this will work on windows.

Collapse -

It's Linux

by jimmy-jam In reply to is this...

I'll give it a try

Collapse -

and it didn't work

by jimmy-jam In reply to is this...

starting to think I may have to reload from scratch.

Collapse -


by m61 In reply to and it didn't work

...this way:

# mysql -uroot -p

you will then be prompted for the password, but is this for a script? as this approach wont really work with a script

Collapse -

Escaping worked for me, or try this

by MaerF0x0 In reply to is this...

Escaping any exclamation mark worked for me. I had forgot that ! had a meaning in bash. Alternatively you could change the password so that it doesnt include any exclamation marks (or other bash special characters)

Collapse -


by Choppit In reply to MySQL password problem

mysql -uroot -p\!password\!

but it's safer to do it interactively

mysql -uroot -p

Related Discussions

Related Forums