What you're aiming for
By the end of this, you'll have four pieces of information to paste into a script's config.php: a database host (almost always localhost), a database name, a database username, and a password. Most control panels generate the name and username for you by prefixing them with your hosting account's username — that's normal, and your scripts don't care what the prefix looks like.
cPanel — the MySQL Database Wizard
This is the fastest route if your host uses cPanel, and it walks you through all three steps in order.
- Log into cPanel and open MySQL® Database Wizard under the Databases section.
- Step 1 — Create a database. Enter a name (something like
directoryis fine — cPanel will prefix it automatically, e.g.cpaneluser_directory) and click Next. - Step 2 — Create a database user. Enter a username and either type a password or use the password generator. Write the password down before you continue — most panels only show it once.
- Step 3 — Add the user to the database. Check All Privileges unless you have a specific reason not to, then click Next.
- You'll land on a confirmation screen listing the full database name, full username, and host. That's everything the script's config file needs.
cPanel — the manual method
If you already have a database and just need to add a user to it, use MySQL® Databases instead of the wizard:
- Under Create New Database, enter a name and click Create Database.
- Scroll to MySQL Users → Add New User, set a username and password, and click Create User.
- Under Add User to Database, choose the user and the database, click Add, then tick All Privileges on the next screen.
Plesk
- Go to Websites & Domains for the site you're installing to, then click Databases.
- Click Add Database, give it a name, and confirm the database server (there's usually only one MySQL/MariaDB server listed).
- In the same screen, add a database user under Related User Accounts → Add New Database User, and set a password.
- Plesk shows the database name, username, and host on the database's overview page — the host is typically
localhostunless your host runs a separate database server.
DirectAdmin
- From the DirectAdmin dashboard, open MySQL Management.
- Click Create new Database.
- Fill in a database name, username, and password — DirectAdmin creates the user and grants it access to that database in the same step, so there's no separate "add user" screen.
- The database name and username DirectAdmin creates are usually prefixed with your account username, same as cPanel.
Other panels, or no panel at all
Plenty of hosts run their own custom panel, or none — just phpMyAdmin and SSH. If you can reach phpMyAdmin directly:
- Log into phpMyAdmin and click Databases along the top.
- Enter a database name under Create database and click Create.
- Click User accounts → Add user account, set a username and password, and under Database for user account choose "Grant all privileges on database" and select the one you just made.
If you only have SSH access and the MySQL command line, the same thing looks like this:
CREATE DATABASE dbname; CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'yourpassword'; GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost'; FLUSH PRIVILEGES;
Putting the details into config.php
Every Bytewriter Pro script that uses MySQL keeps its connection details in one file — usually config.php in the root install folder. Open it in a text editor (not Word — plain text only) and fill in the four values from whichever method you used above:
define('DB_HOST', 'localhost');
define('DB_NAME', 'cpaneluser_directory');
define('DB_USER', 'cpaneluser_dbuser');
define('DB_PASS', 'yourpassword');
Save the file, upload it if you edited it locally, and load the install script or admin login page in a browser to confirm it connects.
Common errors and what they mean
- Access denied for user 'x'@'localhost' — the username or password in config.php doesn't match what the panel created. Double-check for a trailing space, and remember the full prefixed username (e.g.
cpaneluser_dbuser, not justdbuser). - Unknown database — same idea, but for
DB_NAME. Use the full prefixed database name shown in the panel. - User has no privileges on this database — the user was created but never added to the database, or was added without "All Privileges." Go back and grant access explicitly.
- Too many connections — usually a shared-hosting resource limit rather than a config problem. Contact your host if it persists under normal traffic.
- Host field confusion —
localhostis correct on almost every shared host, since the database server runs on the same machine as PHP. Only change it if your host's documentation tells you to use a different hostname or IP.
Once the database connects, the rest of the install for any of our self-hosted scripts is just uploading files and following the on-screen setup — most of them, including Directory and Multi-Poll, can now create the first admin account entirely from the browser, so you shouldn't need SSH again after this step.