Just like all e-commerce applications (like amazon) let you access the database and browse items without logging in or signing up, how can i do this with mysql database (without logging in with username and password)

closed as too broad by mustaccio, MDCCL, ypercubeᵀᴹ, hot2use, LowlyDBA Feb 11 at 13:49

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I removed the Microsoft SQL Server tag from your question since you mentioned mysql. – Dan Guzman Feb 9 at 11:47
  • Your assumption is probably not quite correct. The web interface lets you access the database. However, the web interface will have some form of authentication so that not just any application from anywhere can access the data. In your case the application would probably have to access the database with some form of authentication to ensure some level of security. – hot2use Feb 11 at 7:09
  • @hot2use if you mean making some sort of authentication for not just any app to access the database (meaning only the specialized app or website) then how this authentication is done?? – Jhon Aug 6 at 12:16
  • I mean it’s possible for anyone to perform SELECT on the database if he knows the address of the database. Isn’t it?? – Jhon Aug 6 at 12:18

Applications often allow anonymous user access but relational databases should be accessed using a minimally privileged account as a best practice.

With a public web application, end users do not access the database directly but through the remote web server, middleware, or other service. The data access layer should then connect to the database using a minimally privileged account.

In MySQL, execute CREATE USER and GRANT to setup the service account. Use those credentials to connect to the database in the data access layer.

  • I don’t quite get your point on middleware or remote webserver. As for what I know, i connect directly the client through php to a low privilege user of the database – Jhon Aug 6 at 12:14
  • @Jhon, you can connect to the database server from any application running anywhere using the account of your choosing as long as you have network connectivity. However, one usually uses some sort of service layer for security, performance, and scalability reasons. – Dan Guzman Aug 6 at 22:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.