How to Connect to MySQL Database

The popular PDO and MySQLi libraries, which are used by all current applications to connect to a MySQL database, are accessible on all accounts and PHP versions. However, before you can use a database, you must first set up a few things.

It is necessary to construct a database before you can employ it. In the MySQL Databases section of your control panel, you may create a database. Simply type a name in the text field and hit the Create Database button.

You'll need to know the database name, username, password, and hostname in order to fully utilize it with your script. Almost all of those details may be found in the MySQL Databases section under Current Databases. The password you use to access into your control panel and FTP is the only parameter that isn't listed. You can reset your password in your client area if you forget it.

Many applications replace the database hostname field with "localhost" or conceal it entirely. You must use the MySQL hostname accurately as it is displayed under your Current Databases; using "localhost" will not work.