Monday, December 10, 2012

How To Enable Remote Access To MySQL Server on Windows Server



  1. Go to the Start Menu and select Run to open a Command Prompt
  2. Browse to the MySQL bin directory. I had to do
    C:>CD "Program FilesMySQLMySQL Server 4.1bin"
    Keep in mind that your directory structure might differ from mine depending on how you installed MySQL. Also you may have to do a few “Clear Directories” (i.e. “CD” or CD..) to get to the base of C:>.
  3. Type in:
    mysql -u root -p
    and enter in your root password when prompted.
  4. If you logged in successfully, you should see:
    mysql>
    and if not, then you will get something like:
    ERROR 1045 (28000): Access denied for user 'blah'@'localhost' (using password: YES)
  5. Enter in
    GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'IP' IDENTIFIED BY 'PASSWORD';
    What this will do is create a new user with ROOT privileges, so be very careful what account you are creating. If you are just using the root account, then replace USERNAME with root. And just so we are clear, USERNAME is the account you wish to create or use. IP is the physical IP address of the computer you wish to grant remote access to. If you enter ‘%’ instead of an IP number, that user will be able to remote access the MySQL server from any computer. PASSWORD is the password you wish to create if it’s a new user or the existing password of an existing account. And yes, you need to use the single quotation.
  6. And finally, you want to run this last command:
    mysql> FLUSH PRIVILEGES;
  7. To exit, just type:
    mysql> quit;