Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

should i need to create mysql accounts for all the user who register on my website or create 1 mysql user and pass cretitials to all users

i am really confused should i need to create seprate mysql accounts for every user who register on my website or just create 1 mysql user to query database for all users somehow i am very confused

if i create 1 mysql user for all users on my site when the number of users would grow it could lead to problem because many user may be querying at the same time which will create multiple CRUD operations which will lead to many problems and can crash database.

i am really confused i some how dont feel its right to allow all my users on website to have mysql account of their own on database . i feel this could some how create a security threat or may be mysql has limit on number of users which can be created i really dont what i am thinking is right or not

should i create a single mysql user to let all my website users to query database to get their respective data and create a database n store all users information in one database n user relationships to connect each other website user

like image 234
sohaan Avatar asked Dec 13 '11 17:12

sohaan


People also ask

Can multiple users use MySQL?

By creating multiple MySQL users, you can assign different privileges to keep your data safe.

Do I need an account to use MySQL?

You need to create an account to use for connecting to the MySQL server running on a given host.

What is the use of creating different users in MySQL?

The MySQL Create User statement allows us to create a new user account in the database server. It provides authentication, SSL/TLS, resource-limit, role, and password management properties for the new accounts. It also enables us to control the accounts that should be initially locked or unlocked.

Why do I need MySQL for a website?

MySQL creates a database for storing and manipulating data, defining the relationship of each table. Clients can make requests by typing specific SQL statements on MySQL. The server application will respond with the requested information and it will appear on the clients' side.


2 Answers

You only create MySQL accounts for things that directly access MySQL. Users of a website are not accessing MySQL. They're accessing a PHP script which accesses MySQL on their behalf.

The ONLY time you'd create per-user accounts is if you were turning your server into a general hosting platform, and each user would be running their own databases within MySQL.

like image 172
Marc B Avatar answered Oct 05 '22 22:10

Marc B


To expand the answer from @Marc B:

I usually set up 3 user accounts for each XAMP project:

  1. project-developer has full access to everything, including CREATE/GRANT. Can create tables and maintain the db.

  2. project-webuser has SELECT access to most things, UPDATE/INSERT access only to those tables directly needed by general web users.

  3. project-webadmin has UPDATE/INSERT access to tables needed to maintain project data. There is usually a separate Admin web page for owners/managers to maintain the web site.

like image 35
dar7yl Avatar answered Oct 05 '22 20:10

dar7yl