Jump to content

Change Database Port


Recommended Posts

I was working my way through the PWS setup but i can't seem to get it to work with a custom port for the database.

If i run the setup on the default ports, the database will be created.


when i'm at the Database settings page, i enter the DB server, instance name and credentials (i've obscured some details)

My MSSQL is setup according to the SQLExpress 2019 documentation and both PWS and SQL run on the same machine.


when i test the connection, i get positive results.


But when i click next, it start to try and create the PWS database and user, but it returns an error.



i've edited the SQL Server Network Configuration as described in the documentations


Unfortunately, i can't seem to get it to work on a custom port. I tried changing the "Listen All" setting to no avail. Nor did it help to enable the "Named Pipes" setting or enabling the SQL Server Browser.

When i open Microsoft SQL Server Management Studio and try to connect to the servername: HOSTNAME,PORT\SQLSERVER   i can connect just fine.

testing it with a powershell command:

powershell -Command "Test-NetConnection -ComputerName 'HOSTNAME' -Port 12345" says the TcpTestSucceeded: True.


The strangest thing i see is when i look in Event Viewer. After i restart the SQL Server service, i see the Event ID 26022 initially show the correct port i specified.

Server is listening on [ any <ipv4> 12345].

but a fraction of a second later, it shows a random port but for localhost:

Server is listening on [ <ipv4> 49699].


I'm a bit at a loss here what i can see/do to fix this problem. Maybe i've missed something during the SQL setup or i'm configuring PWS wrong. Hopefully you can help me out here.

Link to comment
Share on other sites

Okay thanks.


We'll need to do some testing to see if we can replicate this issue. If you change the port number back to 1433 for now, then you won't need to specify this during the intitial setup.


Once you have everything running, you can change the port number again, and then edit the database connection string in the web.config file. The format would be HOSTNAME,PORTNUMBER\SQLEXPRESS



Click Studios

Link to comment
Share on other sites

It seems i can't get it to work on 1433 either anymore.

I try to run as clean as i can, so that i don't come across problems that may be caused by something unknown. So i always try to revert any changes i just made if it doesn't work. initially after i opened this post i removed PWS and removed the SQLEXPRESS instance according to MS docs:

Uninstall existing instance - SQL Server | Microsoft Docs

because I was hoping i didn't need to reinstall MSSQL entirely.

After confirming that the SQL server was running on its defaults settings, i tried to launch the PWS configuration site but i ended up getting the same 2 error screens as above. No database was created (nor the PWS user). I can't think of anything that i changed/tested that could result in this problem. I just tried to run the config again, the database connection test came out positive and the configuration was running longer than usual. Now i get the 2nd database error (Sorry no screenshot). but this time the database is somehow/somewhat created including the PWS user.

The error said i needed to remove the database 'passwordstate' the user 'passwordstate_user' and try again.


Either way, PWS wasn't working. 


The only thing i can image is something with the firewall. I did add a rule to it, but i later removed that because PWS still wasn't working. On this server only the Private and Public Firewall are running (Windows 2019, 1809, build 17763,2145). Domain firewall is disabled currently.

I'll reinstall the entire IIS/SQL/PWS to see if i can get working on the default port again.



I've managed to make PWS work on the default port again. Seems i wrecked some registry causing MSDTC not working anymore. After reinstalling en enabling MSDTC i was able to reinstall PWS entirely and on the default DB port 1433.

Let me know if you find any solution to changing the DB port.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...