phpMyAdmin Tutorial: How to Create a Database and Create a Table (MySQL tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so once you've got your local web server set up on your computer for your local server and you're ready to start getting into your web programming the first thing you need to do is you need to understand how to work with mysql databases now mysql databases are some of the most common types of databases used with php applications and php websites so in this video i'm actually show you how to create new mysql databases using phpmyadmin so first thing you want to do is you want to start with actually logging into phpmyadmin now you can do this using your default username and password of root being your username and a blank password or if you've already set up a custom username and password or changed your password for your root account be sure to use that now from the phpmyadmin home page it's super easy to actually create a new database you've got two different options you can actually click on the new button on the left hand side underneath the phpmyadmin where it shows you a list of every single database you have currently on your server the other option is if you click on the databases tab at the top you can also create a new database going to this page either way it will take you to the same location same page where you can actually create a new database now for this mysql course i'm going to create a new database called course underscore mysql and then in the next box you can actually select what type of database that your database is actually going to be created now this actually is just the formatting and the general character set for your database itself i'd usually just recommend going with the default whatever it's already set to for your server then when you're ready to create your new database just click the create button pretty straightforward you get a little pop-up notification that you saw there that says your new database has been created and then phpmyadmin should automatically redirect you to your new database and then you'll see at the top we're currently selected to our new database called course underscore mysql alternatively if phpmyadmin does not automatically redirect you to your newly created database or later on when you're trying to get to your database you can actually super easily get to it just by clicking on the database name in the left-hand column now once you're inside of your database and you're actually selected to that database or whichever one you want you can actually easily create new database tables right from this page so to create a new table i'll just create a basic one called users like you would create in some sort of a user application or member system application and you can select the different number of columns that you want for your database now i already have four type in here so just hit the go button and this will actually begin us with the process of creating our new database table so inside the name you're required to fill in a name for a unique name for every single database or every single table column for your database now later on when you actually get into your php code that you're going to use to actually select information and insert data into your database you're going to need to use each of these unique identifiers the unique column names in order to send and retrieve information from your mysql database and each of the respective tables so i'll just go ahead and fill in a couple of pretty standard username or user database table information for a very simple web application usually you'll have an id that's a unique identifier that's associated with every single record and that will usually have an integer type or it may be a big integer bigint and then typically you'll also have an auto increment set so go ahead and check that box and you'll notice that our index has been set to a primary now this is super important for any unique identifiers that you're going to use in any web application basically you want to make sure that every time a new record is inserted into the database that that unique identifier is truly going to be unique every time you add a new record it's going to auto increment up that's that a underscore i auto increment and setting that as a primary key just make sure application just a little bit faster in indexing your database like that now the next name i'm just going to type in as user so that'll be the username i'll select it to a varchar or variable character so basically that can just be a different a different collection of characters and letters and numbers and symbols all that kind of stuff now when you set a var chart as a type in phpmyadmin and mysql you're required to set a length so typically for user names i'll just use a 50 character length for each of those and then in the php code the application later i'll limit that to however much i want another very common column name in a user database table is your password obviously you want to be able to log into your secure account using a unique password that every user will be able to have so i'll just set that to a length of 100. now when you're inserting and saving passwords into your database you want to make sure that you're using some amount of security and using password encryption and hash encryption and i'll have a video on that later in the series but basically it'll take a single string of whatever the user enters as their password and then we'll throw it into a hash function built into php and it'll give us kind of a gobbly combination of letters and numbers and that's the password hash and that'll be saved in the database by the plain text password that the user typed in and again with a varchar required to set a length typically for passwords i set to 100 characters but usually a md5 hash or something like that it's something like 32 characters or something like that so 100 characters should be perfectly good now the last column i'm going to create is just a date column so typically when i create a user table i usually put in a date column which i can use to record when the user's account was created and i'll be using the php time function to give a numeric value for the specific time all the way down to the second that the user account was created so i'll just leave that as an integer type now once you're satisfied with every single name and type and auto increment you've got set up for all the columns inside your database table you can go ahead and just click the save button it'll process the request and then boom it'll automatically redirect you to select to the table that you created and then you're done your database and your database table have now been created and then you're ready to work on inserting new data into your database [Music] table [Music] you
Info
Channel: Nick Frostbutter
Views: 42,635
Rating: undefined out of 5
Keywords: phpmyadmin tutorial, mysql tutorial, php tutorial, phpmyadmin create database, phpmyadmin create table, create a database, create a table, edit a table, edit a database, mysql course, phpmyadmin course, create a database and table, mysql database, mysql table, create a mysql database, create a mysql table, xampp server, manage mysql database, manage mysql table, manage phpmyadmin, heytuts
Id: j1WVRtcauqw
Channel Id: undefined
Length: 7min 1sec (421 seconds)
Published: Wed Sep 02 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.