Results 1 to 5 of 5

Thread: Connecting to MySQL database without IP restricitions

  1. #1

    Thread Starter
    Registered User
    Join Date
    May 2023
    Posts
    4

    Connecting to MySQL database without IP restricitions

    Dear Gents,

    I am trying to make an application to perform certain calculations for industries. The application will be available online and will be free of charge.

    The main purpose of this application is to force the users to register through a registration form, so that my company can collect marketing data to be used in future projects. (Of course users will have to accept that their data is going to be used for marketing)

    My idea so far is to make a Login form and a Registration form.

    A) At first users will enter their data in the registration form, and the application will generate random username and password, which will all be added to the database.

    B) After verification, I will manually send usernames and passwords so that user can use them to login.

    C) Then, users will use the Login form, to access the application and use its features.

    The problem now is that to make the app write or read in my database I have to get the public IP of each user and manually add it as an access host in Remote MySQL, cPanel, which is absolutely not doable.

    So my questions are:
    1) Is there a way to make my database safely open for any public IP to access and write?
    2) Is there some kind to intermediate that can write and read data from my database without compromising the security of the database?

    Thanks in advance.

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,307

    Re: Connecting to MySQL database without IP restricitions

    Quote Originally Posted by MahmoudRefaat94 View Post
    A) At first users will enter their data in the registration form, and the application will generate random username and password, which will all be added to the database.
    I wouldn't do this. Just let the user pick a name and a password, or if you must generate a name for them let them chose their own password and just impose some minimum security restrictions.
    Quote Originally Posted by MahmoudRefaat94 View Post
    B) After verification, I will manually send usernames and passwords so that user can use them to login.
    This is really insecure, if you are sending out passwords then this is an easy way for someone to snoop them etc. Let the user pick a password and make sure you only store a hash, not the original password. You certainly don't want to ever be sending passwords out though.

    Quote Originally Posted by MahmoudRefaat94 View Post
    The problem now is that to make the app write or read in my database I have to get the public IP of each user and manually add it as an access host in Remote MySQL, cPanel, which is absolutely not doable.
    You would only need the web app to be able to write to the database, you shouldn't need the user to have access. If you are using Javascript or similar to access the database then you are going about things the wrong way. Ideally you should have an API that talks to the database and the Javascript would communicate with the API. Having a database directly open to the entire internet is an incredibly bad and insecure idea.

    Quote Originally Posted by MahmoudRefaat94 View Post
    1) Is there a way to make my database safely open for any public IP to access and write?
    No. Not safely.
    Quote Originally Posted by MahmoudRefaat94 View Post
    2) Is there some kind to intermediate that can write and read data from my database without compromising the security of the database?
    Create an API layer to handle the DB access.

  3. #3

    Thread Starter
    Registered User
    Join Date
    May 2023
    Posts
    4

    Re: Connecting to MySQL database without IP restricitions

    Quote Originally Posted by PlausiblyDamp View Post

    Create an API layer to handle the DB access.
    Thanks for your reply. Can you please support by providing what to search to find relevant tutorials or help? because, i don't get results when i google your answer. (Unfortunately I am very new at this)

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    109,991

    Re: Connecting to MySQL database without IP restricitions

    You need to create a Web API project and have that perform all the database access. You then host your API on a web server somewhere, much as you would a web site. All installations of your application then make calls to that API to retrieve and save data. You can easily find information on how to create a Web API project in VS. Web API is basically MVC without the V, i.e. your controller actions return data to be consumed rather than a view to be displayed in a browser. It is basically the evolution of .NET web services.

  5. #5
    Addicted Member
    Join Date
    Jan 2022
    Posts
    211

    Re: Connecting to MySQL database without IP restricitions

    3rd the API.
    At this point MS is no longer providing/supporting updates to the web API/VB.Net and is steadfast with ASP.NET/Core/C# Web API. You can however still create a 'legacy' VB.Net Web API/MVC project. How this happens depends on your platform. If you are hosting the IIS on win server you will need to install the latest .Net Framework and enable IIS and management roles (research the roles required). I would recommend that you first get a working model on your windows 10/11 desktop using the publish to folder method. When you have a working model that is responding/posting properly then engage on the win server IIS host and simply alter your publish path.
    Last edited by vbdotnut; Sep 20th, 2023 at 07:07 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width