Hello Every this is Ashok from domainracer.com
and today I am going to show you how to create database and username and password how to
connect database with username and password create table and entries in that and lastly
I am going to show you with the help of example so you can able to integrate your database
within PHP program so lets start with the process firstly we have to go into the cpanel
section in that cpanel section go to the File Manager ok in file manager public folder here
we are going to create a new simple PHP script that is login.php so I’m going to edit that once I already have
a program for a login script just I am going to paste over here
so let’s start with the actual program description what is the program is so here it is the first
line illustrate that this is the database and database connect with that is the local
host username and password and this here I am going to paste the actual database and
in that this is a user user is a table and username and password are the two interesting
that there is a column ok so now we knows the basic requirements
we need a database we need a table we need a username and password that is column and
database connection username and password so that we have to go into the cpanel dashboard
in that MYSQL database section from here we can able to create our database firstly we
will create our database.database name is MMK123 underscore demo and clicking on create
so account database has been created so let’s go into the bottom and I am copying this database
and pasting on database section in the program so next stage is to create user user is demo
one password is [email protected] number12 @ so it’s got a match and now I am going to create user
has been successfully created so here it is the user and here it is database no users
have a privilege for this database so now I am going to create privileges for this database
go down and you will find this option add user to database
so in this select your username and database and click on add button so it will ask you
something privileges in this case I am giving you all privileges that is add delete create
and all. make changes .changes has been successfully
saved go back ok so go down this is our database username so this is database username and
here it is an ID and password ok save it so now we have created user name and database
as well and also we have connected user name with a database so the last step is to create
a table and in that columns so click on PHP my admin section here database has open this
is a cpanel username in that our database click on it in that we are going to create
a new table with a two columns that is username and password so here user name password and
type is varchar I am going to put the length is 20 20 and living all this things as a default
one because I am going to use that as for testing purpose and its besed on your requirement
so its saved so user this is a user name in that in the browse section you will find the
column the entries and in the structure section you will see the username and password these
are the two columns with all properties you can able to change it from here now we have
created table and columns so for login we required username password right so far that
I am going to click on insert button and in that username is admin and password is admin
and click on go button so in this case is one row inserted successfully click on browse
option here you can able to see that user name is admin password is admin in this case
we have completed all the parts for our projects so now we are we going to the browser and
type our url greentseo.com login.PHP and in this case we have appeared a username and
password field and login button so I’m going to insert user name as an admin and password
has admin and click on login button let’s see what happened ohh thanks for login means,
in this case, we have successfully connected with a database successfullly retrive the
data and confirm that we have logged in successfully lets see if we type a wrong password in this
case what will happen its wrong passsword that is login fail means we have successfully
implemented the project have great time.bye

How to connect PHP & MySQL? Step by Step with #2 Example Script in cPanel

17 thoughts on “How to connect PHP & MySQL? Step by Step with #2 Example Script in cPanel

  • June 7, 2017 at 11:04 pm

    in database _connect.php what is the host equal ?

  • July 16, 2017 at 3:25 am

    in my cpanel it is connected to database but is not inserting in the it.
    please help

  • August 31, 2017 at 3:57 pm

    thanks sir

  • October 2, 2017 at 1:25 pm

    Sir I need your phone code the same you used in video

  • October 14, 2017 at 2:31 am

    thank you so much.

  • November 9, 2017 at 10:09 am

    mysqli function work connected byt mysql_connect() function not work how to solve this problem?what version use in inside cpanel php version use this connection?

  • March 24, 2018 at 12:08 pm

    Thank You !! (Y)

  • April 9, 2018 at 7:28 pm

    U .. U are the man ! U saved ma day ! Thank u !

  • June 16, 2018 at 9:58 am

    i created sql database and user, but user wasn't show inside phpmyadmin

  • November 17, 2018 at 5:08 pm

    good video

  • December 4, 2018 at 5:04 am

    I love you ❤️

  • December 4, 2018 at 5:05 am

    You think is better cpanel or phpmyadmin ?

  • February 27, 2019 at 6:58 pm


  • April 22, 2019 at 4:13 am

    alhamdolillah <3 thanks a lot, you save my life
    i really appreciate it

  • July 30, 2019 at 8:02 am


  • September 1, 2019 at 7:41 pm

    thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanks alot

  • January 10, 2020 at 1:01 am

    I found your video extremely helpful Thanx man (kind of funny too 🙂 )


Leave a Reply

Your email address will not be published. Required fields are marked *