Question Locked

MySQL password problem

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Can you help me crack the root password? Ha! Kidding :D

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.

#mysql

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?

7 replies

by m61

...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.

by jiminpa

starting to think I may have to reload from scratch.

by m61

...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

by maerf0x0

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)

by choppit

mysql -uroot -p\!password\!

but it's safer to do it interactively

mysql -uroot -p

This discussion is closed to new replies.