# How can I setup a remote connection to MySQL?

URL: https://sohaib.com/blog/how-can-i-setup-a-remote-connection-to-mysql
Author: Sohaib Khan
Published: Oct 16, 2013
Updated: Sep 8, 2026
Category: Cloud & Infrastructure

> mysql or: /usr/local/mysql/bin/mysql Your shell prompt should now look like this: mysql> Run this command: GRANT ALL PRIVILEGES ON . TO USERNAME@IP IDENTIFIED BY "PASSWORD"; FLUSH PRIVILEGES; 📚 Related Articles →…

```plaintext
mysql
```

or:

```plaintext
/usr/local/mysql/bin/mysql
```

Your shell prompt should now look like this:

```plaintext
mysql>
```

Run this command:

```sql
GRANT ALL PRIVILEGES ON *.* TO USERNAME@IP IDENTIFIED BY "PASSWORD";

```

```plaintext
FLUSH PRIVILEGES;
```
