'how can i fix the password to read in mysql

I have a problem .I have the code that needs to connect to a MySQL database in the TERMINAL. but i can not open because this password does not support %pK]-K8FgAM,HS8$7}uY

mysql -N -h 127.0.0.1 -P 3306 -u test -p%pK]-K8FgAM,HS8$7}uY -D read 


Solution 1:[1]

Put mysql -h localhost -u username -p It will ask for password in terminal

Solution 2:[2]

You can put single quotes around the password

mysql -N -h 127.0.0.1 -P 3306 -u test -p'%pK]-K8FgAM,HS8$7}uY' -D read 

Solution 3:[3]

The problem is that the $ character is interpreted specially by the shell. See following illustration

$ echo %pK]-K8FgAM,HS8$7}uY
%pK]-K8FgAM,HS8}uY
$ echo '%pK]-K8FgAM,HS8$7}uY'
%pK]-K8FgAM,HS8$7}uY

So, please enclose the password in single quote.

Solution 4:[4]

Thank you for all.I found the problem by this way

username='test'
password='%pK]-K8FgAM,HS8$7}uY'
database='read'
mysql -N -h 127.0.0.1 -P 3306 -u $username -p$password -D $database

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Raja M
Solution 2 abney317
Solution 3 Fat P
Solution 4 Larsiya