PHP/MariaDB/MySQL

What Port is MariaDB/MySQL On?

Updated September 2026 58,083 views 3 min read
PHP/MariaDB/MySQL | Updated September 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).

Frequently Asked Questions

What port is MariaDB/MySQL on?

MariaDB and MySQL run on port 3306 by default on all Ultra Web Hosting servers. For applications on the same server, such as WordPress or Joomla, use localhost as the database host instead of a port number.

Why can't my application connect to the MySQL server on localhost?

The problem is almost never the port. The most common causes are a wrong database name (cPanel prefixes it with your username), wrong database-user credentials, or a user that has not been granted access to the database. Check all three in cPanel under MySQL Databases.

Why am I getting Connection Refused on port 3306?

If you are connecting remotely, add your IP address in cPanel under Remote MySQL and confirm your IP has not been blocked by the firewall. Remote MySQL connections are refused by default until you whitelist the connecting IP.

How do I connect to MySQL from an external application?

Enable Remote MySQL in cPanel, whitelist the IP you will connect from, then connect using your server hostname, port 3306, and your cPanel database username and password. Whitelist specific IPs rather than using the % wildcard.

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 September 2026 · Browse all Database articles

Share: X in Reddit f Email
  • 1053 Users Found This Useful

Was this answer helpful?

Related Articles

Learn About MariaDB

PHP/MySQL | Updated January 2026 Ultra Web Hosting uses MariaDB as the database server on all...

Cannot Connect to MariaDB MySQL Database

PHP/MariaDB/MySQL | Updated March 2026 The "Could not connect to the database" error means...

The MySQL Server Is Currently Offline - DBCACHE Exit 11

Server Maintenance | Updated March 2026 When cPanel displays "The MySQL server is currently...

Strict Standards: Non-static method JLoader::register() should not be called statically in

PHP/MySQL | Updated January 2026 The "Strict Standards: Non-static method JLoader::register()...

How can I view/modify data in my MySQL database?

PHP/MySQL | Updated January 2026 phpMyAdmin is the primary tool for viewing, editing, and...



Save 30% on web hosting - Use coupon code Hosting30