How Confusing is Root? Very Confusing!
One of the most difficult concepts within Linux to understand is root it's not that the word root is difficult or difficult to interpret as much as the sheer number of various instances root itself is used within Linux, all of which mean something within the context that it is used.
The word root is most commonly used to define the filesytem base or origin, so when you type the command cd /, you elect to change directory to the origin or beginning of the filesystem. However this is not all that it means, the word root also refers to home directory also called root now this directory does not reside in the directory called home like the others no this might be what you would expect, no to make matters worse the root home directory resides itself on the origin of the filesystem called root. This is where you need to take a deep breath because home root resides in /. If I was to use command line notation to drive us to the home of root user we would use the command cd /root .
We then have root login, this is the root administrator account for the Linux operating system who's home directory does not reside in the home directory, root administrator account is the most important and powerful user account found on the Linux operating system, sadly it is also the most abused. The root administrator account is the account most likely to be used to build your chosen Linux operating system to disk, as such when the root password account is set it seldom if ever changes, this in contrast to policies that force periodic changes used on normal user accounts. On Desktop systems this approach has little bearing but on production data systems and servers it very much does, as this makes the system itself more vulnerable to attacks.
Root can also refer is the base root of one's home directory in command line notation these directories are shown in the format of /home/username eg.
* /home/paul * /home/jane * /home/george
And so on, regardless of who you login as, the command line notation used to change to the root of your home directory is cd ~, this command regardless of who you are will default to the logged in user own home directory. So if you login as paul your own home directory will be /home/paul if jane logged in then there home directory will be /home/jane if root however was to login then somewhat differently there home will be /root these are common default settings they can be changed, but this would mean editing a file callled /etc/passwd.
There is one fundamental flaw with the above that can also be addressed and that is the ability for a non privileged user to view any part of the current operating system or even other home directories. This can be, and often is restricted especially for file transfer protocol users (ftp), the concept is called chrooting it is similar to a root in that files outside the boundary of a logged in users home directory will not be allowed, and therefore becomes the root directory or / effectively or pseudo root of that user currently logged in. Sometime it is necessary to copy commands used in a files transfer to be included in the chrooted home directory.
To further confuse matters "root" is also used with the likes of "mysql" or "My Sequel" server which is a relational database management system or (RDBMS) and runs as a server service providing multi-user access to any number of databases. As a server it runs pretty much like it's own Operating System with it's own list of users, it's own file structure, and own list of commands. To access these said commands you need to be a privileged user or "root" yes root, another one. As with root user for a Linux Operating System, root user in Mysql has full privileges.
So it you are already root user on the OS does that mean you are root for the database? No it definitely does not they are completely separate you will need to login to Mysql in a similar way to which you do with the OS. To gain access to mysql you need to login to the database this can be done with the following command.
You will notice the -u and root have no space between them this is nether a mistake or deliberate the configuration is acceptable in both formats. When executed the command will require the root password as setup by the administrator owner.
I am an an enthusiast of Linux as an Operating System but the different root's does take a lot of getting used to.
If I have missed any relevant material relating to root please feel free to comment below.