Install MySQL on PHP Server - Hsanokklis/2023-2024-Tech-journal GitHub Wiki
Pre-Lab:
- Make sure you php installed in your web server (rocky)
- We will add the
php-mysql
package to your installation:
Install MySQL
- Install MariaDB, which is a community-developed fork of MySQL:
yum install mariadb-server mariadb
- Start the service:
- Set MySQL to start on server boot:
systemctl enable mariadb.service
- Run this command to finish setting up the installation:
mysql_secure_installation
- You will be asked for the root password, beccause you didn't set it earlier, press Enter to set a password now.
- Type Y to set the root password
- Enter and confirm the new password
- You will be asked more questions as part of the security configuration. It is best practice to respond Y to these system prompts.
- Restart Apache
sudo systemctl restart httpd.service
Test PHP processing on Apache
- Create a new PHP under the
/var/www/html
directory:
sudo vim /var/www/html/info.php
- When the file opens, type in the following code:
<?php
phpinfo();
?>
- Save and close the file (!wq)
- To verify it worked, type this URL into your browser(Kali)
- http://your_servers_IP_address/info.php
Service working!
