Home >Backend Development >PHP Tutorial >Tutorial steps for connecting MySQL and PHP (pictures and texts)
In this article, we introduce the integration of PHP and MySQL. Since it is integrated with MySQL, we must first install MySQL. Below we will introduce the installation method of MySQL.
The first step is to download MySQL. To download PHP, you can go to the PHP Chinese website download site to download the latest version.
The second step is to install the MySQL database
The third step is the same as installing Apache. Create a MySQL folder under the PHPedu folder and install it in the folder. Change the installation directory and click Next
The fourth step is to start the installation
Just click Next from this step,
Until this step, we set up an administrator, set the password here, and click Next
Click the arrow to continue the installation
Even if the installation is complete
Next we will integrate PHP and MySQL. First open the php.ini configuration file under the PHP folder in the editor, and then locate extension_dir in the editor, around line 720, as shown below:
Next, uncomment the corresponding line of code, as shown below:
At this point, the MySQL configuration we need to modify has been modified. The next step is to restart our Apache server. After the database is opened, it needs to be connected. How to connect to php mysql? We need to write a piece of code to connect to the database, as shown below:
Run it on the browser and you will see that the connection is successful
Okay, now the integration of our database and our PHP is complete.
The above is the detailed content of Tutorial steps for connecting MySQL and PHP (pictures and texts). For more information, please follow other related articles on the PHP Chinese website!