# Want to change the mysqld port from 3306 to any other port

**URL:** https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987
**Category:** Percona XtraDB Cluster 5.x
**Tags:** mysql, percona
**Created:** [June 22, 2021, 3:25pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987 "2021-06-22T15:25:33Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![sghose](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sghose](https://forums.percona.com/u/sghose)
#### Post date: [June 22, 2021, 3:25pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/1 "2021-06-22T15:25:34Z")

</div>

Please help

Want to change the mysqld port from 3306 to any other port

And successfully start the XtraDB cluster

---

<div class="post-metadata">

### Author: ![Michael\_Coburn](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/michael_coburn/32/18_2.png) [@Michael\_Coburn](https://forums.percona.com/u/Michael_Coburn)
#### Post date: [June 22, 2021, 5:13pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/2 "2021-06-22T17:13:56Z")

</div>

Hi @sghose , thanks for posting!  
You can change the port that Percona XtraDB Cluster uses for client connections from 3306 by setting the variable `port` under the `[mysqld]` section of your configuration. For example if you wanted to set the port to listen on `3307` you would have:

```auto
[mysqld]
port=3307

```

---

<div class="post-metadata">

### Author: ![sghose](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sghose](https://forums.percona.com/u/sghose)
#### Post date: [June 22, 2021, 5:30pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/3 "2021-06-22T17:30:20Z")

</div>

Thanks Micheal,

Is this the correct location?  
/etc/mysql/percona-xtradb-cluster.conf.d/client.cnf  
[client]  
port = 3306  
socket = /var/run/mysqld/mysqld.sock

Just for clarification  
Steps

1. Stop the mysql services in all the three nodes
2. make the changes in all the nodes
3. start the services in all the three nodes  
Or Bootstrap nodes  
Please suggest if the steps are incorrect for changing the port

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [June 22, 2021, 6:01pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/4 "2021-06-22T18:01:34Z")

</div>

That is not correct. `[client]` referrers to the client application. In order to change mysql server you need to use the ‘[mysqld]’ section exactly as Michael said above. Since you are changing the default port for mysql, you will need to change the [client] section to match as well, otherwise you will keep getting errors about inability to connect to mysql.

1. stop mysql on all three nodes
2. make [mysqld] and [client] changes
3. bootstrap node1
4. start node2
5. start node3

---

<div class="post-metadata">

### Author: ![sghose](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sghose](https://forums.percona.com/u/sghose)
#### Post date: [June 23, 2021, 10:11am UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/5 "2021-06-23T10:11:21Z")

</div>

Ubuntu 18.04

I have changed the client.cnf and the my.cnf but bootstraping fails  
root@morpheus01-app:/etc/mysql# /etc/init.d/mysql bootstrap-pxc

- Bootstrapping Percona XtraDB Cluster database server mysqld \* The server quit without updating PID file (/var/run/mysqld/mysqld.pid).  
[fail]

location  
nano /etc/mysql/my.cnf  
[mysqld]  
port=3307

pxc\_encrypt\_cluster\_traffic=ON  
max\_connections = 300  
wsrep\_provider=/usr/lib/galera4/libgalera\_smm.so

wsrep\_cluster\_name=morpheusdb-cluster  
wsrep\_cluster\_address=gcomm://

# for wsrep\_cluster\_address=gcomm://Enter the IP address of the primary node first then remaining nodes. Separating the ip addresses with commas

wsrep\_node\_name=morpheus01-app  
wsrep\_node\_address=IP\_Address

wsrep\_sst\_method=xtrabackup-v2  
wsrep\_sst\_auth=sstuser:Password  
pxc\_strict\_mode=PERMISSIVE  
wsrep\_sync\_wait=2

skip-log-bin  
default\_storage\_engine=InnoDB  
innodb\_autoinc\_lock\_mode=2

pxc-encrypt-cluster-traffic=OFF

So I am trying to install Morpheus on the same machine as the XtraDB but need to change the sql port 3306 to something else

If you can help in which location I should change the mysqld and is there any specific syntax?  
is it port=3307 or port = 3307

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [June 23, 2021, 1:41pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/6 "2021-06-23T13:41:39Z")

</div>

> [@sghose](#):
>
> port=3307 or port = 3307

There is no difference between those two. Spaces don’t matter.

What do your error logs say as the reason for not starting?

---

<div class="post-metadata">

### Author: ![sghose](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sghose](https://forums.percona.com/u/sghose)
#### Post date: [June 23, 2021, 1:49pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/7 "2021-06-23T13:49:27Z")

</div>

2021-06-23T10:05:57.058554Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit\_defaults\_for\_timestamp server option (see documentation for more details).  
2021-06-23T10:05:57.060225Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.33-36-57) starting as process 3235 …  
2021-06-23T10:05:57.063580Z 0 [Warning] You need to use --log-bin to make --log-slave-updates work.  
2021-06-23T10:05:57.063599Z 0 [Note] WSREP: Setting wsrep\_ready to false  
2021-06-23T10:05:57.063609Z 0 [Note] WSREP: No pre-stored wsrep-start position found. Skipping position initialization.  
2021-06-23T10:05:57.063614Z 0 [Note] WSREP: wsrep\_load(): loading provider library ‘/usr/lib/galera4/libgalera\_smm.so’  
2021-06-23T10:05:57.063647Z 0 [ERROR] WSREP: wsrep\_load(): dlopen(): /usr/lib/galera4/libgalera\_smm.so: cannot open shared object file: No such file or directory  
2021-06-23T10:05:57.063654Z 0 [ERROR] WSREP: wsrep\_load() failed to load the provider(‘/usr/lib/galera4/libgalera\_smm.so’): Invalid argument (22). Need to abort.  
2021-06-23T10:05:57.063658Z 0 [ERROR] Aborting

2021-06-23T10:05:57.063669Z 0 [Note] Binlog end  
2021-06-23T10:05:57.063717Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2021-06-23T13:47:57.370480Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit\_defaults\_for\_timestamp server option (see documentation for more details).  
2021-06-23T13:47:57.372150Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.33-36-57) starting as process 9478 …  
2021-06-23T13:47:57.375657Z 0 [Warning] You need to use --log-bin to make --log-slave-updates work.  
2021-06-23T13:47:57.375675Z 0 [Note] WSREP: Setting wsrep\_ready to false  
2021-06-23T13:47:57.375684Z 0 [Note] WSREP: No pre-stored wsrep-start position found. Skipping position initialization.  
2021-06-23T13:47:57.375688Z 0 [Note] WSREP: wsrep\_load(): loading provider library ‘/usr/lib/galera4/libgalera\_smm.so’  
2021-06-23T13:47:57.375714Z 0 [ERROR] WSREP: wsrep\_load(): dlopen(): /usr/lib/galera4/libgalera\_smm.so: cannot open shared object file: No such file or directory  
2021-06-23T13:47:57.375720Z 0 [ERROR] WSREP: wsrep\_load() failed to load the provider(‘/usr/lib/galera4/libgalera\_smm.so’): Invalid argument (22). Need to abort.  
2021-06-23T13:47:57.375723Z 0 [ERROR] Aborting

2021-06-23T13:47:57.375733Z 0 [Note] Binlog end  
2021-06-23T13:47:57.375772Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [June 23, 2021, 4:02pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/8 "2021-06-23T16:02:36Z")

</div>

> [@sghose](#):
>
> 2021-06-23T10:05:57.063647Z 0 [ERROR] WSREP: wsrep\_load(): dlopen(): /usr/lib/galera4/libgalera\_smm.so: cannot open shared object file: No such file or directory

This is strange. You installed PXC8 via yum/apt? Does this library exist at the noted path? Wait. This is mysql 5.7? You can’t use galera4 with 5.7. You need to remove all of this and install a proper PXC8 or install the correct PXC5.7 packages.

---

<div class="post-metadata">

### Author: ![sghose](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sghose](https://forums.percona.com/u/sghose)
#### Post date: [June 23, 2021, 5:32pm UTC](https://forums.percona.com/t/want-to-change-the-mysqld-port-from-3306-to-any-other-port/10987/9 "2021-06-23T17:32:48Z")

</div>

Thanks Matthew,  
I have changed the my.cnf file to galera3 and it bootstraped perfectly and the three cluster are connected successfully with the port for mysqld to 3307

Just for curosity,  
if that was the issue how did it worked with the default port…

Thanks a lot for the help
