CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > MySQL > How to create user in MySQL for remote access?

How to create user in MySQL for remote access?

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Last updated: July 1, 2026 · 2 min read · 0 Comments
Share: in X

To create a user in MySQL for remote access, we need to follow these steps:

First, we need to edit the MySQL configuration file and change the bind-address parameter to allow connections from any IP address. We can find the configuration file in different locations depending on our operating system and MySQL version.

For example:

On Linux:

It could be /etc/mysql/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnf.

On Windows:

It could be C:\ProgramData\MySQL\MySQL Server 8.0\my.ini.

Once we find the file:

Open it with a text editor and look for the line that says bind-address = 127.0.0.1. Change it to bind-address = 0.0.0.0 or to the IP address of the interface that we want to use for remote access.

After changing the file we can save the file and restart the MySQL service.

Second, we need to create a new user account with a secure password and grant it the appropriate privileges on the databases and tables that we want to access remotely.

We can use the CREATE USER and GRANT commands in MySQL to do this.

For example, if we want to create a user named myremoteuser with the password mypass and grant it all privileges on the database mydb, we can use the following commands:

CREATE USER 'myremoteuser'@'%' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON mydb.* TO 'myremoteuser'@'%';
FLUSH PRIVILEGES;

The ‘%’ symbol means that the user can connect from any host. We can also specify a specific host name or IP address instead of ‘%’.

For example, if we want to allow the user to connect only from the host 192.168.1.10, we can use ‘myremoteuser’@‘192.168.1.10’ instead of ‘myremoteuser’@‘%’.

We can also limit the privileges to specific operations, such as SELECT, INSERT, UPDATE, DELETE, etc. 

Click on Privileges Provided by MySQL to view more detail on MySQL privileges.

If you want to learn more MySQL Commands then click this link.

Related Posts:

  • Install and Set Up Java Development Environment
  • java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
  • How to Connect Java Application to a Remote Database…
  • How to Install Ollama on Windows, Linux, and macOS:…
  • How to change Git remote URL
  • How to Delete Last Commit Git: A Step-by-Step Guide
Tags:databasesql
Was this article helpful?
← Previous ArticleHow To Enable Cross Account Access In AWS S3?
Next Article →What is MongoDB Atlas?

Recent Posts

  • How to implement Passwordless Authentication in Spring Boot: A Step-by-Step Guide
  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Linkedin

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
© 2026 CoderSathi. All rights reserved. Privacy Policy · Sitemap