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

前端 未结 12 2032
北海茫月
北海茫月 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
    
    0 讨论(0)
  • 2020-11-22 11:03
    1. Try to flush privileges again.

    2. Try to restart server to reload grants.

    3. Try create a user with host "192.168.233.163". "%" appears to not allow all (it's weird)

    0 讨论(0)
  • 2020-11-22 11:03

    MySQL ODBC 3.51 Driver is that special characters in the password aren't handled.

    "Warning – You might have a serious headache with MySQL ODBC 3.51 if the password in your GRANT command contains special characters, such as ! @ # $ % ^ ?. MySQL ODBC 3.51 ODBC Driver does not support these special characters in the password box. The only error message you would receive is “Access denied” (using password: YES)" - from http://www.plaintutorials.com/install-and-create-mysql-odbc-connector-on-windows-7/

    0 讨论(0)
  • 2020-11-22 11:07

    New location for mysql config file is

    /etc/mysql/mysql.conf.d/mysqld.cnf
    
    0 讨论(0)
  • 2020-11-22 11:12

    if you are using dynamic ip just grant access to 192.168.2.% so now you dont have to worry about granting access to your ip address every time.

    0 讨论(0)
  • 2020-11-22 11:13

    I was getting the same error after granting remote access until I made this:

    From /etc/mysql/my.cnf

    In newer versions of mysql the location of the file is /etc/mysql/mysql.conf.d/mysqld.cnf

    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    #bind-address           = 127.0.0.1
    

    (comment this line: bind-address = 127.0.0.1)

    Then run service mysql restart.

    0 讨论(0)
提交回复
热议问题