Labs - MySQL Cannot login as root


After enabling the mysqld service, I tried to login with root password and got “-bash: !0: event not found”. How can I proceed further.


Tried for the second time and got the following error.

Hi @selan

Kindly check the full solution below:

1 Like

Hello @selan,

You need to put the password in single-quote or double-quote, in case your password contains special characters that cannot be processed by the command line. As you can see you are getting a syntax error for providing unexpected token in the command line.

Please check the following steps, I performed with the same password as yours. I have used the docker mysql. The command I have used to connect:-
docker exec -it mashiur_mysql mysql -u root -p"je_M(q2(qw1T"

Another way is not providing the password in the command line,
docker exec -it mashiur_mysql mysql -u root -p
Here you will be prompted for the password. Type in the password, and you should be able to login.

Hope it helps.

Mashiur Rahman

It works. Thanks Mashiur.

It works. thanks for your support.