Installing MySQL and
Connecting it with PHP
• Anna Charisma F. Dechavez, MTA, ITF+
Steps
• Install MySQL
• Configure PHP.INI
• Create Database, username and
password, grant access
• Configure IIS to support the
website
• Create php file for scripting
• Test connection to MySQL with
PHP scripting in web browser
Requirements
•mysql 8.0 installer
community version
•Notepadd ++
•Internet connection
Step 1 : Install
MySQL
This is the installer for mysql
Installing mysql 8.0
• Run the installer by
double clicking.
• A window will open,
wait for the option
of installation
option. Select the
“CUSTOM” setup
type
• Click “NEXT”
Add the
following
products
based on the
figure shown,
then hit NEXT
• Click on “EXECUTE”
to install the
following
applications for
mysql.
• Just wait for the
setup to finish the
installation then hit
NEXT.
•After clicking on
”NEXT”, this is
what the next
window will
look like, just hit
on NEXT.
•In the
dropdown
arrow of
config type
select “Server
Computer”.
•After
selecting the
“SERVER
COMPUTER
” click on
“NEXT”.
•In the
AUTHENTICATIO
N METHOD select
the second option
of “Use Strong
Password”, then
click “NEXT”
•Input
password and
retype the
password.
Note: Don’t
forget the
password this
will be use for
the database
•Click on “ADD
USER” to
create a user.
•Input the
password and
retype. Click
“OK” then
“NEXT”.
•In this
window, no
configuration
are required
so just click
on “NEXT”
•In this
window, no
configuration
are required
so just click
on “NEXT”
•Click on
“EXECUTE”
to apply the
changes made
in the
previous
windows.
•If all
configuration
s are
completed,
click on
“FINISH”
•Click on
“NEXT”
•Click
FINISH. You
may uncheck
the “Start
MySQL
Workbench
after setup”
Step 2 :
Configure PHP
Configure PHP to connect with MySQL
•Open php.ini using the
notepad++ (php.ini found in
C:\\Program Files\Php 8.2
•Save the changes you made, click on
“save” twice because it requires
administrative access.
PHP.INI CONFIGURATION
Please make sure the directory is the same
with the name of your PHP folder in
Program Files. Also create a folder with
“Web” filename with “temp” folder inside.
Step 3 : Testing
MySQL with
PHP using
phpMyAdmin
Go to this site and download the latest
phpMyAdmin, the latest version is 5.2.1
Extract the zip file of the phpMyAdmin to any
folder, you may use the default location where you
placed the downloader file of phpMyAdmin.
Inside the extracted folder of the
phpMyAdmin,rename the folder to a shorter
filename, you may use phpMyAdmin
Copy the phpMyAdmin to the IIS folder under
the wwwroot
Open your web browser and type,
http://localhost/phpMyAdmin/ or
http://localhost/phpMyAdmin/index.php
Steps • Create a Database via phpMy Admin (in
the example database name is
“sampleDB”
• Create Username and Password (in the
example the username is “user1” with
the password “password1”
• Give access to the Username created
• Create PHP Scripting
• Configure IIS
• Test website using the “localhost”
Step 4 :
Configure IIS
and Testing
website
Configure in IIS
•Add website
•In the Bindings, for the
meantime use the
“localhost” as the
hostname.
•Name of site and
application pool is “phpsite”
To test connection, write the following codes
in the notepad ++ then save it as index.php in
the root directory of IIS
END