Connect to MySQL with PHP in XAMPP / Create a new database

Connect to MySQL with PHP in XAMPP / Create a new database


This video will discuss how to create a database using PhpMyAdmin and connect to that database using PHP- mysqli. Syntax is discussed as well as some best practices. There a re many outdated tutorials which use mysql - these should not be used interchangeably.
Closed Caption:

hello and welcome in this video I'm
going to cover how to connect to my
sequel database using PHP and so you can
see I'm using xampp here i'm just going
to work off the control panel
so if you have xampp you should be
probably doing like this i'm going to
click on the admin button next to my
sequel but this is going to do is going
to get me over to PHP my admin
now if you are working with a live host
you probably have this tool available to
you or something similar is just your
job to find it when you were free host
or something you might not but if you're
paying for roasting you probably have
this tool and just your job to find it
so really I said we're going to connect
to a database we need to do that we need
to create a database first I mean I've
got some over here but let's create one
so i'm gonna click on the databases tab
and we'll call it test DB great basic as
it gets
just going to go with the default
collation which is basically how the
physical data is represented on disk so
I create that and now I've got a
database called test DB now i can
connect to this database now if I was
really doing something I would set up
users and passwords and everything like
that but i really want to talk about
xampp for a second here
xam to say that security is an
afterthought is not really accurate
xampp is disabled every security what
you can
so when you connect to a database you
can have a username and a password the
default username and password for the
super user is root and no password so
that's relevant because i'm going to go
here and create a kinect script
so here i am a notepad plus plus i'm
going to write a little PHP here just
opening and closing tags
nothing yet since so really there's
three variables which we're going to be
concerned about the first one is a user
now as I said yeah in xampp it's just
route
that's the that's the username you can
create more if you have a live web site
it's not going to be rude right there
would be a big mistake if you were
really had the username fruit
the other thing is going to be the
password and that is literally just
blank and so in xampp they disabled
everything they can disable just to get
you up and running and testing your site
you can adjust these things but by
default they're not there and the last
variable is just the name of the
database
mine was test DB you're feeling a little
PHP syntax here
it's not the friendliest stuff in the
world but that's what it looks like and
really so the magic part here is just
one line and so this connection is very
well going to be used multiple times so
I'm going to store it in a variable such
as this and really what I want to do is
I want to create a new mysqli and they
lived here is a function and i'm going
to call that function so that function
takes for argument's the way i'm going
to use it the first one is localhost
now this is going to work on X am this
would likely work on a web server as
well it might seem like its it would
only work on my computer because i'm
running exhale but that's not really the
case
what that really means is that the my
sequel server is on the same servers as
a patchy and it is in some cases if it's
not you might have to do some kind of an
absolute link right there
the next piece of information is the
username and the last is the password
sorry and the database and so you can
see why we used variables here because
if you have a real website out there
just substitute whenever you use the
name is substitute whatever your
password is if you don't know what that
is
check your email has typically like as
soon as you pay for something you get an
email with all these you know usernames
and passwords is probably in there or
get a hold of support that in theory
should work but it's good practice to
right or we're going to call function
called I alright so what Die means is if
this piece right here
if the left hand of this expression
doesn't go well
some reason i have a syntax error then
it's going to die and i just terminate
the program right there and it spits out
a message like unable to connect it will
tell it will spit out whatever is held
spit out
and so it's either going to be
successful or it's going to die
and at this point I think it's time to
save my file
i'm going to call it connect dot PHP
notice the file extension is gonna yell
at me cause I already have one
I just tried to make this video in her
to go with the audio didn't work
I think I replaced it and let's see if
it works
so I'm going to run it nothing happens
nothing should happen because i need to
run it through the local host write PHP
is not going to be interpreted if i
don't know i run through local host and
nothing happens that's a little
concerning
so I recall what this test is either
creates a connection or it fails there's
no output so it's good practice to just
do a little echo down here and Michael's
going to say like a great work great
little enthusiasm layer and so that
might look like it would happen every
time but in theory it's either going to
successfully create the connection or
die right now if in in the case that it
dies it's never going to get to this
line because it just stops right there
so i'll save this and you'll see why
didn't admit it so I refresh and great
work
read the implication that it didn't die
and i didn't get any warnings so it
probably worked so let's let's see what
it looks like let's say the user did not
know a password
all right save that i refresh and she
not so great work i still get the great
work because it didn't technically died
i just write access denied so it's a
warning warnings don't warnings are in a
complete failure warnings are just
they're just bad and you should address
them and if its kind of sticking out to
your thinking my gosh that seems kind of
weird to the password is just in plain
text well it is and there's all kinds of
things you can do to make that unless
difficult situation or school right i
mean you can do a better job than what
we're doing here
but in theory all you got to do is
substitute in the values that you want
and so at this point you should be able
to connect your database so this this is
how it is by default in xampp you want
to create users or you know you've got a
live web site with some real user names
and
passwords all you gotta do is substitute
that's the kind of beauty of writing it
out like this and you should be up and
running at this point
from here you can actually do some
database thing this like we're your
database and just connecting is nothing
but really this is something that you
could get hung up on so now at this
point you can connect and and from there
you can create some tables and and do
some meaningful things
thanks for watching

Video Length: 06:41
Uploaded By: Ken Swartwout
View Count: 394,651

Related Software Products
Access-to-MySQL
Access-to-MySQL

Published By:
Intelligent Converters

Description:
Access-to-MySQL is a program to move MS Access databases to MySQL server. All MS Access data types and attributes are supported. The program works with Unix and Windows MySQL servers.BRBR License InformationBRBR Single-User License allows clients to install the software product on exactly one (1) computer system. Client can store a backup copy of the software but cannot use two copies of the software at any one time. Single-User License does NOT allow to make use of the software ...


Related Videos
How to connect to Mysql database through windows command line (cmd)!
How to connect to Mysql database through windows command line (cmd)!

Access your databases through command line, instead of user graphical user interface. hr / bClosed Caption:/b hello youtube today i'm going to show you how to use my secret base on command line and we are also going to look how to connect the database through command line CMD after that we are going to create a database through command line when you install some this program here it's normally create the beam for ...
Video Length: 07:31
Uploaded By: Teach-the-World InfoData
View Count: 105,155

How To Connect to MySQL Using PHP
How To Connect to MySQL Using PHP

ABCO Technology prepares a short video for students on how to connect to a MySQL Database using PHP Code hr / bClosed Caption:/b hi this is a sample recording from aapko technology today I'm going to show you how to connect your database using PHP code we're using the mysql database which it goes it well in hand with most PHP based websites when you're creating a interactive website it is important that you basically connect ...
Video Length: 16:20
Uploaded By: ABCO Technology
View Count: 91,181

Export Access Database to MySQL
Export Access Database to MySQL

In this tutorial, I show how to connect MS Access to MySQL vis ODBC. Then I explain how to export date from Access to MySQL. hr / bClosed Caption:/b alright so in this video I'm going to show you how to establish connection between Microsoft Access and my sequel and then extract an access database to bicycle you want to start off by downloading the odbc drivers make sure you download the latest one which is 3.5 1.30 and then ...
Video Length: 02:55
Uploaded By: Michael Herman
View Count: 69,724

Episode 19 - How To Enable Remote Access To MySQL Server on Windows Server
Episode 19 - How To Enable Remote Access To MySQL Server on Windows Server

this tutorial will show you how to enable access to your MySQL server so other could manage it with a GUI :). For more information please check my blog at http://bjtechnews.wordpress.com or follow me @BJTechNews. hr / bClosed Caption:/b hey guys welcome to bj technews episode 19 and today I'm going to show you guys how to enable remote access to your my secret server on the Windows platform ok so i have two machines that have mybr ...
Video Length: 06:23
Uploaded By: BTNHD
View Count: 63,681

Connecting MS Access to MySQL
Connecting MS Access to MySQL

Demo on connecting MS access as a client to MySQL server hr / bClosed Caption:/b alright so welcome people back to I plans of technology- poor vast and onion soubise shall be demonstrated hold with three degrees on was thinking you need to rest the microphone on settings for driver great so like we said we're going to be continuing to show all we wanna have a web server running so I've already have one installed and as ...
Video Length: 11:08
Uploaded By: Paul Bastien
View Count: 49,488

How to Open MySQL Database With MS Access
How to Open MySQL Database With MS Access

Follow this easy step by step tutorial to learn how to open MySQL database in Microsoft Access, through an ODBC connection. Don't forget to check out our site http://howtech.tv/ for more free how-to videos! http://youtube.com/ithowtovids - our feed http://www.facebook.com/howtechtv - join us on facebook https://plus.google.com/1034403827176... - our group in Google+ It can be needed in many situations to link our MySQL database to any other database, ...
Video Length: 01:57
Uploaded By: Internet Services and Social Networks Tutorials from HowTech
View Count: 47,574

PHP Tutorial for Beginners 30 # How to connect to MySQL database using PHP
PHP Tutorial for Beginners 30 # How to connect to MySQL database using PHP

PHP Connect to the MySQL Server connecting to mysql database php android connecting to php mysql How to access a MySQL database with PHP code How to Connect to MySQL From a PHP Document 3 Ways to Connect to MySQL Using PHP MySQL Tutorial - Connect PHP/MySQL Tutorial Connect to Your MySQL Database using PHP PHP Connect to the MySQL Server hr / bClosed Caption:/b hello guys when once again in the last video i have shown you ...
Video Length: 15:38
Uploaded By: ProgrammingKnowledge
View Count: 40,819

Connect Access / OOBase to MySQL Using ODBC Part 1 of 2
Connect Access / OOBase to MySQL Using ODBC Part 1 of 2

This video demonstrates how to install and configure the MySQL ODBC driver on a Windows-based PC and then use it to connect either Microsoft Access or Open Office Base to a MySQL database. Part 1 of 2. hr / bClosed Caption:/b hello and welcome in the short screen movie im gonna show you how to connect to a my sequel database from access using ODBC or the open database connectivity API the first thing you need to do is install the ...
Video Length: 09:53
Uploaded By: Bruce Fulton
View Count: 37,721

MySQL - Remote Access to MySQL Server on Linux CentOS 6.3 Part 1
MySQL - Remote Access to MySQL Server on Linux CentOS 6.3 Part 1

In this tutorial I talk you through installing and configuring a MySQL server to allow remote access on Linux using CentOS 6.3. So first, download and install the mysql server: yum install mysql mysql-server Next make it so as the mysql server with be running on server startup, issue the following command: chkconfig mysqld on Next start the mysqld service service mysqld start Next run the command ...
Video Length: 17:05
Uploaded By: David Does Programming
View Count: 31,119

Import csv file to mysql database using workbench
Import csv file to mysql database using workbench

Please subscribe for more video tutorial VB.NET with mysql (insert, delete and update) VB.NET with ms access (insert, delete and update) VB.NET with mssql (insert, delete and update)
Video Length: 02:43
Uploaded By: Stephen Pacaldo
View Count: 28,286

Copyright © 2025, Ivertech. All rights reserved.