How to connect with MySQL

Both the popular PDO and MySQLi libraries are available on all accounts and PHP versions, which are the libraries all (modern) scripts use to connect to a MySQL database. However, to use a database, you need to configure a few things first.

Before you can use a database, you need to create the database first. You can create a database through your control panel in the section called MySQL Databases. Simply enter a desired name in the text box and click Create Database.

To use the database with your script, you’ll need to know your database name, username, password and hostname. Almost all of those details are listed under Current Databases in the MySQL Databases section. The only parameter not listed there is the password you use to login to your control panel and FTP. If you don’t remember that password, you can reset it through your client area.

Note that many scripts prefill the database hostname field with “localhost” or even hide it completely. Using “localhost” will not work, you have to use the MySQL hostname exactly as it’s listed under your Current Databases.

Finally, please note that it’s NOT possible to connect to the free hosting databases from outside the hosting platform. This means you cannot access the database from desktop or mobile applications directly, or use them in applications hosted elsewhere.