Question :
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)
Answer :
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.