You are here: Home » Programming & Computer » MySQL » Accessing MySQL Located at Central PC through client PC(s)

Accessing MySQL Located at Central PC through client PC(s)


Figure1: Small Office Network Topology

For say, you are having an internal web-based application and database reside at central PC. You want your client PC(s) to be able to run the sql script through their own PC without needed to go to the central PC to run the script.

To allow you run the sql script from your command prompt at client PC(s):-
At Client PC(s):
1) Get the client Full computer name: My Computer > Right click then point to Properties and click on it > click on Computer Name tab > Look for Full computer name.
2) Get the client IP Address: Open Command Prompt window and type ipconfig, copy the IP Address.

At Central PC:
1) Open Command Prompt window and change directory to mysql bin folder:-

C:\>cd c:/wamp/bin/mysql/mysql5.1.36/bin
C:\>mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor. …………………………..

mysql> grant all on database-name.* to ‘client-full-computer-name’@’client-ip-address’;
mysql> flush privileges;
mysql> grant all privileges on database-name.* to root@’client-full-computer-name’ identified by ‘database-admin-password’ with grant option;
mysql> flush privileges;

Test and verify from client PC(s):-
1) Locate and copy mysql.exe from MySQL bin folder at central PC.
2) Paste mysql.exe into client PC(s) for say C:\
4) Open command prompt: Start > Run > Type in cmd and press OK button. Change directory to the location that you have just paste the mysql.exe at:-

cd c:\
mysql -u root -p
Enter password: ********

If you do not encountered any Error 1130, meaning you are now able to write sql script to query for the data through command prompt at client pc(s).


Leave a Reply

Your email address will not be published. Required fields are marked *