Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Database Foundations Securing and Maintaining a MySQL Database Setting up Multiple Users

Ante Vujčić
Ante Vujčić
11,306 Points

Database permissions?

I'm not sure I follow, what are users actually used for in databases? If you have website which only displays data from database and you want to give all site visitors permission to only SELECT data from database do you need to create any users or is this more referred to SQL injection? Thanks

1 Answer

David O' Rojo
David O' Rojo
11,050 Points

If your website is only reading data from a database, then a database user with the permissions to only read the data must be created so your website can stablish a connection with those credentials. Then, if a malicious user manages to inject SQL commands trough your website to the database, it won't be able to alter any of the data or the schema 'cause the database server will only allow data reading commands with that connection.