How to connect to a database
With most web scripts, any data created when handling a page request is discarded when the script finishes. To be useful, scripts of consequence need persistant data storage. This usually means interacting with a database. X10 offers MySQL and PostgreSQL database servers, and SQLite embedded DB engine. Since SQLite doesn't run as a server, none of the following is needed for it.
Before you can connect to a database server, you need to create a database and database user using cPanel. Once you've done that, any script that needs to connect to your database will use the following information:
- Your cPanel username, followed by an underscore ("_"), followed by the DB username you created in cPanel.
- The password for the DB user you created in cPanel.
Remember, the name of all your DB users and databases begin with your cPanel username followed by an underscore, though tables can have any name you wish (subject to the limitations of the DB server you're using).