What Port is MariaDB/MySQL On?

PHP/MariaDB/MySQL | Updated 2026

MariaDB/MySQL runs on port 3306 by default on all Ultra Web Hosting servers. For applications running on the same server (WordPress, Joomla, etc.), use localhost as the database host.

01. Database Ports

Service Port Notes
MariaDB / MySQL 3306 Standard port. Use localhost for apps on the same server
PostgreSQL 5432 Available on VPS/dedicated plans

02. Connecting to MySQL Remotely

By default, MySQL connections are only allowed from localhost (the same server). If you need to connect from an external application, a local development machine, or a different server, you need to whitelist your IP address first.

  1. Log into cPanel - go to your hosting control panel
  2. Click "Remote MySQL" - in the Databases section
  3. Add your IP address - enter the IP you'll be connecting from. You can use % as a wildcard, but we don't recommend it for security reasons
  4. Connect with your database tool - use your server's hostname or IP, port 3306, and your database username/password from cPanel
Warning

Never add % (all IPs) to Remote MySQL unless you absolutely need it and your database user has a very strong password. It opens your database to connection attempts from anywhere on the internet. Always whitelist specific IPs instead.

Connection String Examples

# MySQL command line
mysql -h yourserver.ultrawebhosting.com -P 3306 -u dbuser -p dbname

# PHP (PDO)
$pdo = new PDO('mysql:host=yourserver.ultrawebhosting.com;port=3306;dbname=yourdb', 'user', 'pass');

# WordPress wp-config.php (local - most common)
define('DB_HOST', 'localhost');

# WordPress wp-config.php (remote)
define('DB_HOST', 'yourserver.ultrawebhosting.com:3306');

03. Common MySQL Connection Issues

"Can't Connect to MySQL Server on 'localhost'"

If your application can't connect to the database, the issue is almost never the port. The most common causes are: wrong database name (cPanel prefixes it with your username), wrong database user credentials, or the user hasn't been granted access to the database. Check all three in cPanel > MySQL Databases. See Cannot Connect to MySQL and Error 2003.

"Connection Refused" on Port 3306

If connecting remotely and getting connection refused, make sure you have added your IP in cPanel > Remote MySQL. Also verify your IP has not been blocked by the firewall. Check with the Firewall Unblock tool.

For other port references: email ports (993, 465, 587), FTP ports (21, 22), cPanel port (2083).

Cannot Connect to Your Database?

Open a ticket with the error message and we will check the connection for you.

Open a Support Ticket

Quick Recap

  1. MySQL/MariaDB: port 3306
  2. Use localhost for same-server connections
  3. Enable Remote MySQL in cPanel to connect externally
  4. Whitelist specific IPs, never use % wildcard
  5. Check cPanel > MySQL Databases for credentials and user assignment

Database connection reference · Last updated March 2026 · Browse all Database articles

  • 1051 Users Found This Useful

Was this answer helpful?

Related Articles

phpMyAdmin - Error Incorrect format parameter

PHP/MariaDB/MySQL | Updated March 2026 The "Incorrect format parameter" error in phpMyAdmin...

How to Add a User to a MariaDB/MySQL Database

PHP/MariaDB/MySQL | Updated March 2026 Every application that uses a database (WordPress,...

What is the proper MariaDB - MySQL import and export format?

PHP/MySQL | Updated 2026 When importing or exporting MariaDB/MySQL databases, the format...

PHP information

PHP/MySQL | Updated 2026 To view your PHP version, loaded extensions, configuration settings,...

Register Globals On Off

PHP/MySQL | Updated 2026 register_globals was a PHP setting that automatically converted URL...



Save 30% on web hosting - Use coupon code Hosting30