Enable remote MySQL connection: ERROR 1045 (28000): Access denied for user

前端 未结 12 2171
北海茫月
北海茫月 2020-11-22 10:06

MySQL 5.1.31 running on Windows XP.

From the local MySQL server (192.168.233.142) I can connect as root as follows:

>mysql --host         


        
12条回答
  •  一整个雨季
    2020-11-22 11:03

    Paulo's help lead me to the solution. It was a combination of the following:

    • the password contained a dollar sign
    • I was trying to connect from a Linux shell

    The bash shell treats the dollar sign as a special character for expansion to an environment variable, so we need to escape it with a backslash. Incidentally, we don't have to do this in the case where the dollar sign is the final character of the password.

    As an example, if your password is "pas$word", from Linux bash we must connect as follows:

    # mysql --host=192.168.233.142 --user=root --password=pas\$word
    

提交回复
热议问题