In recent days, the server's database (SQL Server) has been subjected to attacks, some people constantly rotation want to log into the database, from the SQL log can be seen, at first I was through the local security policy to disable the corresponding several attack IP, while the database sa account is disabled, think it should be OK , after all, my server is not so precious, why do you hold on to it?! Who knows the next day to see, crouching trough, unexpectedly still in attack, changed the IP, while constantly changing the database account to attack, CNM, this person really egg hurts. The log graph is as follows:
Then I am ready to change the default port number of the database, so as not to be attacked again, hey, I also ache, change the database default port number, means I want to change each application's configuration file, lying trough, really uncomfortable, but no way, change it!
But in the process of change, there have been some problems, recorded here.
What if I change the default port number for SQL Server? The default port for MSSQL is 1433 and can be changed in SQL Server Configuration Manager, as follows:
After the change, to check whether the "TCP/IP" is enabled, otherwise does not work, after the change, restart the SQL Server Configuration Manager services:
At this time, quit the MSSQL client, re-login database, here I thought the database connection is: localhost: port, tried several times not, the original middle is a comma instead of colon, so the database connection should be: Localhot, port, so it can. Then change the configuration file for each app, adding the port number to the database access connection: <add name= "Zhuchengwang" providername= "System.Data.SqlClient" connectionstring= " Server=localhost, 2321;D atabase=xxx; Persist Security info=true; User id=xxx; password=xxx; Connect timeout=600 "/> try it.
Finally, there is a pit, what is it? I am in my local use MSSQL client to connect server database, database link is 1.2.3.4, port, how to connect is not connected, why, the application can access, on the server with MSSQL client can also access, why I do not local? This indicates that the database is now locally accessible, the extranet is not accessible, why? The original is to forget in the server firewall rules in the previous modified database port number opened outside the network access, pit ... In the end, of course, the firewall rules inside the open can be ah, haha ~ ~ Tease
SQL Server changes the default port number