How to change the SA password and default port number of the SQL Server database qq752923276 csdn blog I want to comment () font size: T | T
This article describes how to change the SA password, change the default port, and set the port number specified by the ADO connection string in the SQL Server database.
AD:
You can change the SA password of an SQL Server database through the stored procedure. You only need to perform the corresponding operations on the Enterprise Manager to change the default port. This article introduces this series of operations. Next we will introduce them one by one.
1. Change the SA Password
Exec sp_password null, '000', 'sa '-- change SA password to 000
Ii. Change the default port of SQL Server
1. sqlserver service uses two ports: TCP-1433, UDP-1434. 1433 is used to provide external services for sqlserver, and 1434 is used to return the TCP/IP Port used by sqlserver to the requester. You can use the Enterprise Manager of SQL Server to change the default TCP port of SQL Server. The method is as follows:
A. Open Enterprise Manager, select "Microsoft SQL servers-sqlserver group" in the left-side toolbar, and open "SQL instance" (the name of the SQL Server server to be modified is used in the actual environment) in the Properties dialog box, click the "Network Configuration (n)" button at the bottom of the General tab to open the "SQL SERVER network tools" dialog box. (You need to restart the computer ).
B. There are TCP/IP protocols in the "enabled protocols" list. Enter the port number to be modified in the default port options in the properties. Another option is to hide the server. If this option is selected, the client cannot view this server by enumerating the server, which protects the server and does not affect the connection.
2. The SQLAgent Service provides services using TCP-1625 and TCP-1640 ports.
3. the SQL query analyzer accesses port 1601 through port 1433 and connects to sqlserver
Iii. Specify the port number for the ADO connection string
Provider = sqloledb.1; Password = 000; persist Security info = true; user id = sa; initial catalog = pubs; Data Source = 192.168.1.106, 3002 // The specified port is 3002
You can change the password of the SQL Server database and change the default port.
View the default port number of SQL server2005
Method 1]
Use SQL statements to view the port number of SQL Server 2005
Check the port number of SQL Server 2005. You can go to the machine where the SQL Server service is installed and find it through the configuration tool SQL Server Configuration Manager (sscm. If the SQL Server server is remote, this method will not work. However, you can also view the SQL Server server logs. If there is a lot of log Content, it will be difficult to find it. Fortunately, SQL Server 2005 provides a very useful system stored procedure sp_readerrorlog. (You may not be able to find it in the SQL Server help document ). Let's get down to the truth.
SQL statement to find the SQL server port number:
Exec SYS. sp_readerrorlog 0, 1, 'listencoding'
Logdate processinfo text --------------------------------------------------------------------------------
20:26:25. 900 server is listening on ['any' <IPv4> 1433].
20:26:25. 900 server is listening on [127.0.0.1 <IPv4> 1434].
20:26:25. 900 server dedicated admin connection support was established for listening locally on port 1434.
Here, 1433 is the port number of the SQL Server listener.
SQL Server 2005 system extended storage process SYS. readerrorlog can read SQL Server server log files. Note that the log file here refers to the SQL Server server log, not the SQL Server database log file.
Method 2]
Click Start in the lower-left corner of the Computer-> Microsoft SQL server2005-> configuration tools-> SQL Server Configuration Manager-> Expand network configuration-> click mysqlserver protocol "--> double-click" TCP/IP "--> select" ip address "to see the port number.
Netstat-An: view the listening port
Netsh firewall show state
Netsh firewall show config
View the use of the netstat-An command
Use the netsh.exe program to set the Port:
Data collection
Collapse the table and expand the table.
Command description
Show allowedprogram shows the allowed programs.
Show config displays detailed local configuration information.
Show currentprofile displays the current configuration file.
Show icmpsetting displays ICMP settings.
Show logging display logging settings.
Show opmode: displays the operation mode.
Show portopening: displays the exception port.
Show service display service.
Show state displays the current status information.
Show notifications displays the current notification settings.
Configuration
Collapse the table and expand the table.
Command description
Add allowedprogram is used to add exception communication by specifying the program file name.
Set allowedprogram is used to modify the settings of existing programs.
Delete allowedprogram is used to delete existing programs that are allowed.
Set icmpsetting is used to specify the allowed ICMP communication.
Set logging is used to specify the global logging option for Windows Firewall or the logging option for a specific connection (interface.
Set opmode is used to specify the global operation mode for Windows Firewall or the operation mode for a specific connection (interface.
Add portopening is used to add exceptional communication by specifying TCP or UDP ports.
Set portopening is used to modify the existing TCP or UDP port settings.
Delete portopening is used to delete existing open TCP or UDP ports.
Set service is used to enable or discard RPC and DCOM communications, file and printer sharing, and UPnP communication.
Set configurications is used to specify whether to notify the user when the program tries to open the port.
Reset resets the firewall configuration to the default setting. It provides the same function as the "Restore to default" button on the "Windows Firewall" interface.
For example:
Netsh Firewall add portopening TCP port number port name
Netsh firewall Delete portopening TCP port number
Name After netsh firewall set portopening TCP port number is changed