---
title: "Changing Your Database Port in WordPress"
description: "If your database is located on a different port, you will need to adjust your connection settings within WordPress to connect to it. In this article, we will show you about changing your database..."
url: https://www.inmotionhosting.com/support/edu/wordpress/change-database-port-wordpress/
date: 2014-03-06
modified: 2022-03-11
author: "Jeff Matson"
categories: ["WordPress Tutorials"]
type: post
lang: en
---

# Changing Your Database Port in WordPress

If your database is located on a different port, you will need to adjust your connection settings within WordPress to connect to it. In this article, we will show you about **changing your database** port within your WordPress configuration.

![How to Change Your WordPress Database Port](https://i.ytimg.com/vi_webp/Ei9eyFuMUms/maxresdefault.webp)

*Don’t have time to read our article on changing your database port? Watch our walk-through video.*

## Changing Your WordPress Database Port

1. First, [log into cPanel](https://www.inmotionhosting.com/support/edu/cpanel/how-to-log-into-cpanel/) and open the [file manager](/support/edu/cpanel/using-file-manager-in-cpanel/). If you don’t use cPanel, you may edit open any text editor you like.
2. Within the file manager, you will navigate to your *wp-config.php* file. This file will be located within your root WordPress directory, typically your *public_html* directory. Right-click it and click on **Code Edit**.
3. Now that you have the *wp-config.php* open, you will want to edit the following line: define( ‘DB_HOST’, ‘localhost:3306‘ ); As you can see, a port number has been added after the “*:*“. Here, simply add the port number of your database server.
