Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
What is the point of the database and adding the new user?
I am slightly confused about what setting up the database does. I have noticed that in the video he names the database and site with the same name; however, what does this actually mean practically and what is stored in that new database. So, for example, will I have to make a new database for each site I install? Furthermore, why do we have to add a new user?
Ram Iyer9,116 Points
The database is the place where all of the data pertaining to your website is stored. For simplicity's sake, you can think of it as an Excel sheet that stored a lot of data about your website.
On the backend of any website (WordPress or not) you have a logical language like PHP, Ruby, Python, Java, etc. and a databasing system like MySQL, Postgres, MongoDB, etc. These two are separate from each other in the sense that one stores the data (the database) and the other processes the data (the logical language).
Backend processing is done based on the requests made by users of your website. An example of a request could be as simple as a user coming to your home page. the request he/she is making is for the HTML/CSS/JS of your home page. In order to serve this request, the logical language (PHP in case of WordPress) will 'query' (or extract) data from the database and send it to the user.
A database in WordPress usually uses MySQL and stores a ton of stuff like settings, user details, plugin information, meta data and so on. This is all information that needs to be stored somewhere so that it can be easily accessed later.
Yes, (not sure how it works while using multisite) you will have to make a new database for each website.
Users can be added for multiple reasons. Suppose there are 4 people working on a WordPress website and you dont want each person to have the same privileges. For example you dont want to allow people you just hired a week back to install new plugins or some jazz like that. You can assign them an editor's role which will not give them admin access. Further if you want to track changes made by team mates, then its easier if everyone has a different user account. You might also want to allow people to sign up on your website like how you sign up for other websites, say Facebook. Stuff like that.