0% found this document useful (0 votes)
3 views2 pages

MySQL Remote Connection Guide

Uploaded by

msajce23
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

MySQL Remote Connection Guide

Uploaded by

msajce23
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MySQL Remote Connection Setup

Guide
This document provides step-by-step instructions to allow a MySQL database, running on a
local (server) laptop, to be accessed remotely from another laptop. The setup focuses on
enabling secure connections while maintaining simplicity.

1. Prerequisites
- MySQL installed on the server laptop.
- Administrative access to MySQL and Windows Firewall settings.
- The server laptop IP: [Link]
- A client laptop with MySQL client installed for testing.

2. Configure MySQL to Listen on All IPs


1. Locate and open the MySQL configuration file ([Link]).
2. Find the bind-address setting.
3. Edit the line to:

bind-address = [Link]

4. Save the file and restart the MySQL service.

3. Create Database and User


Connect to MySQL locally and run the following SQL commands:

```sql
CREATE USER 'intern'@'%' IDENTIFIED BY 'Intern@123';

GRANT ALL PRIVILEGES ON *.* TO 'intern'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;

```
auser `intern` who can connect from any host (`%`).

4. Open Firewall Port


Allow inbound traffic on port 3306 (MySQL default) in Windows Firewall:
1. Open Windows Defender Firewall → Advanced Settings.
2. Go to Inbound Rules → New Rule.
3. Select Port → TCP → Specify 3306.
4. Allow the connection and finish the wizard.

5. Test Remote Connection


From the client laptop, run the following command to test the connection:

```bash
mysql -u intern -p -h [Link] -P 3306
```
Enter the password `Intern@StrongP@ssw0rd` when prompted.

Alternatively, use PowerShell to test port connectivity:

```powershell
Test-NetConnection -ComputerName [Link] -Port 3306
```

6. Security Recommendations
- Restrict user access by specifying IPs instead of `%` (e.g., `'intern'@'10.225.30.%'`).
- Use strong, unique passwords.
- Keep MySQL and the operating system updated.
- If possible, use SSL/TLS for encrypted connections.

Example Scenario
In this example, a team member (intern) needs to access the `mydb` database remotely from
another laptop on the same network. By following the above steps, they can securely
connect to the MySQL server at `[Link]` using the provided credentials.

You might also like