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
输入 mysql -h localhost -u 用户名 -p 它会在终端询问密码
您可以在密码周围加上单引号
mysql -N -h 127.0.0.1 -P 3306 -u test -p'%pK]-K8FgAM,HS8$7}uY' -D read
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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.