allow remote connections sql server code example

Example 1: mysql allow remote connections

#open /etc/mysql/mysql.conf.d/mysqld.cnf 
#and change
#bind-address            = 127.0.0.1
#to
#bind-address            = 0.0.0.0

#then grant root all privaleges to root
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

#If you ran above command and accidently
#did not change password for root you can run this:
ALTER USER 'root'@'%' IDENTIFIED BY 'MyNewPass';

Example 2: sql server allow remote connections

1. Windows Firewall ->Advanced Settings->Inbound Rules

Add a rule to enable TCP port 1433 (default port for SQL Server)

2. Run SSMS (SQL Server Management Studio) on SQL Server machine

Server Properties -> Security -> SQL Server and Windows Authentication mode (Enable)

3. Server Properties - > Connections -> Allow Remote Connections ..” should be checked

4. Add a SQL login (if not already there)

 5. Enable SQL Service to listen on TCP/IP

Check SQL Server version and run appropriate version of SQL Configuration Manager to enable TCP.

Tags:

Sql Example