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
    Permalink

    in database _connect.php what is the host equal ?

    Reply
  • July 16, 2017 at 3:25 am
    Permalink

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

    Reply
  • August 31, 2017 at 3:57 pm
    Permalink

    thanks sir

    Reply
  • October 2, 2017 at 1:25 pm
    Permalink

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

    Reply
  • October 14, 2017 at 2:31 am
    Permalink

    thank you so much.

    Reply
  • November 9, 2017 at 10:09 am
    Permalink

    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?

    Reply
  • March 24, 2018 at 12:08 pm
    Permalink

    Thank You !! (Y)

    Reply
  • April 9, 2018 at 7:28 pm
    Permalink

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

    Reply
  • June 16, 2018 at 9:58 am
    Permalink

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

    Reply
  • November 17, 2018 at 5:08 pm
    Permalink

    good video

    Reply
  • December 4, 2018 at 5:04 am
    Permalink

    I love you ❤️

    Reply
  • December 4, 2018 at 5:05 am
    Permalink

    You think is better cpanel or phpmyadmin ?

    Reply
  • February 27, 2019 at 6:58 pm
    Permalink

    THANK SO MUCH YOU DONT KNOW HOW I SCREAM!

    Reply
  • April 22, 2019 at 4:13 am
    Permalink

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

    Reply
  • July 30, 2019 at 8:02 am
    Permalink

    super

    Reply
  • September 1, 2019 at 7:41 pm
    Permalink

    thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanks alot

    Reply
  • January 10, 2020 at 1:01 am
    Permalink

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

    Reply

Leave a Reply

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