#3 Introduction to PostgreSQL: Creating A New User


English (Auto-generated)

in this video we will learn how to create a new user in Postgres at the same time, we will also go over some of the basics command and Postgres that you will often use. So when Postgres is installed, it automatically creates a database user that matches with your user name so that you can get started right away. So for example when I type the SQL, I would already have a user configured by default from Postgres. So as you can see it's a user name that matches my computer. They have already created one for me. But how do I know that I did log into my postgres user is because we see the hash sign here. So the default user that they create for you is a super user and super users have a hash sign. What that means is that super user is a user who can bypass all permission checks. So it has powerful permissions and it's important to not grant these permissions by mistake. But if you happen to create a new user with a super user permission and you don't want that, we can learn to revoke these permissions in the later tutorial. As for now if P SQL does not work for you, we can log in into another default user that postgres has created for us. So because I have already logged in, I would have to log out first. So one way to accept postgres SQL is backslash cube. This is a command for quitting. So as you can see I am back to my percentage side and no longer in the Elena hash. So the other default user that everyone can log into is called the SQL post grass. So as you can see this is another default user that I can log into. That Postgres has already created for us. And we can also see the hash sign because once again we are logged in as a super user. So I'm just gonna do it again quickly quick login to my other main super user. Another command that you guys would need to often use is back slash bu. This shows us a table of users or roles that we have already created. So as you can see here for me, my default user, Alina has a list of attributes. That's only my main default user has. I created cat development lab er and vagrant for my other projects. That is not a part of this tutorial but for now you can just ignore these for So how do we create a new user? All we have to do is type create role because in Postgres is actually called pro not user um the user name that you want. So for me I'm just gonna call it test one but you can call it user name anything you want whatever you want. Your users to me. So let's call it test one with log in password. Remember that your password has to be in quotations. So I'm just gonna call my password password and if you click enter right now you will see that nothing happened. And it did not work. That is because we have to put a semicolon at the end of every sentence so I would have to put a semi colon here. But even if it's not in the same line, it still works. So if I click enter now you will see that I have created a rope. And once again if we want to see the table of users that we've created now we have to type this backslash. Bu and you can see that we created a new user called Test One. But because we didn't grant any permission for super user, it will be empty in the next video. We will learn how to grant user permissions and revoke them. Mhm.
104 Views 0 Likes 0 Comments

This video will teach you how to create a new user in postgreSQL

Leave a comment (supports markdown format)