Download the latest Generally Available (GA) release of MySQL at https://dev.mysql.com/downloads/mysql/. Download the Windows MSI Installer package. The MySQL installer MSI 32 bit will install both 32 bit or 64 bit binaries.
Double-click the MySQL Installer and follow the on screen instructions. I usually accept all the default instalation settings except on the "choosing a setup type" part, I choose "Server only".
Connecting PHP with MySQL
Open up PHP Configuration file located at "C:\Apache\php\php.ini" under the Dynamic Extensions find the extension below:
;extension=php_mysqli.dll
Uncomment it by removing the semicolon ";" in front of it:
extension=php_mysqli.dll
Save the configuration and restart the Apache Server.
Testing MySQL Script.
Open up Notepad, copy and paste the following codes, enter your MySQL password and save the file into the Apache Document Root "D:\MyWebs" as "mysqltest.php"
<?php
$dbServer='localhost';
$dbUser='root';
$dbPass='xxxx'; //Enter MySQL password.
$dbName='mysql';
$link = mysqli_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect to MySQL");
print "<h1>Connected to MySQL successfully</h1>";
mysqli_select_db($link,"$dbName") or die("Could not Select Database");
print "<h1>Database selected successfully</h1>";
mysqli_close($link);
?>
Open up your browser and navigate to "http://localhost/mysqltest.php"
Here is a video on YouTube How to install MySQL on Windows 10
No comments:
Post a Comment