To connect WordPress to the MySQL Database. We have to first create a database. In this, we have to see whether our WordPress site is on the localhost or on the cPanel.
If we connect the database on the localhost, then for this we need to have xampp and wamp installed for the pc. If we want to connect our website to the database on the server (cPanel) then there must be a cPanel.
Connect database on localhost
Here we have to see whether our WordPress is already installed or we are installing a new WordPress. If we are installing a new WordPress, then we have to download WordPress for this. We should always download only the latest version of WordPress.