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

前端 未结 12 2057
北海茫月
北海茫月 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 10:59

    By default in MySQL server remote access is disabled. The process to provide a remote access to user is.

    1. Go to my sql bin folder or add it to PATH
    2. Login to root by mysql -uroot -proot (or whatever the root password is.)
    3. On success you will get mysql>
    4. Provide grant access all for that user.

    GRANT ALL PRIVILEGES ON *.* TO 'username'@'IP' IDENTIFIED BY 'password';
    

    Here IP is IP address for which you want to allow remote access, if we put % any IP address can access remotely.

    Example:

    C:\Users\UserName> cd C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin
    
    C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin>mysql -uroot -proot
    
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root';
    Query OK, 0 rows affected (0.27 sec)
    
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.25 sec)
    

    This for a other user.

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'testUser'@'%' IDENTIFIED BY 'testUser';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)
    

    Hope this will help

提交回复
热议问题