SQLCMD utility : connection to second instance does not work - sqlcmd

I have only SQLCMD utility installed locally and want connect to MSSQL instance, but it seems the tool cannot parse the instance name
example:
sqlcmd -S SERVER\INSTANCE -U sa -P password
However, I can use this command from the machine where SQL Server is already installed.
Error message:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]..
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

To use SQLCMD to connect to a remote server instance use the full URI of your server over the network like so;
sqlcmd -S FULLSERVERURI\INSTANCE -U sa -P password
for example, if you had your server at 'someplace.com', your connection would be
sqlcmd -S someplace.com\INSTANCE -U sa -P password
The machine/server would need to have port 1433 open. Consider your network security options.

Please make sure you enable TCP/IP Protocol. This is different from allowing network connections in the server properties.
This is a MSSQL 2012 example, but I have it tested on MSSQL 2017 Developer (full) and still works the same (and also, fails just the same when disabled)

Related

Error when using the command line terminal to connect to the Azure MySQL server

I'm using the command line prompt on my Windows computer to connect to my Azure MySQL server.
hostname=flashguard.mysql.database.azure.com
username=damiboyflashguard123
port=3306
I entered following on my cmd
mysql -h flashguard.mysql.database.azure.com -P 3306 -u damiboyflashguard123 -p
and entered the password. Then I'm getting following error,
ERROR 2003 (HY000): Can't connect to MySQL server on
'flashguard.mysql.database.azure.com:3306' (10060)
By the way I checked my firewall settings, and it shows firewall is approving on 3306 port requests as follows.
I installed MySQL client in my local machine and tried connecting to Azure mySQL client via command line terminal and was connected successfully:-
ERROR 2003 (HY000): Can’t connect to MySQL server on
‘flashguard.mysql.database.azure.com:3306’ (10060)
Make sure your MySQL server name with username and password does not have any syntax missing or spelling errors. Add your local machine’s IP to the allowed list of Azure MySQL servers like below:-
Make sure your MySQL server is in a ready state and also try to connect to your MySQL server from your Azure Portal to check the connectivity.
Verify your connecting string from Azure Portal like below:-
I ran the above command in my local machine’s command line terminal and I got connected to the azure MySQL server successfully like below:-
mysql -h server-name.mysql.database.azure.com -u xxxxconuser -p xxxxxxxxxn#123
Output:-
When I removed the Client IP from the azure MySQL Networking tab, I got the same error code as yours, refer below:-
Error:-
Verify if you’re connected to any VPN that is restricting you from connecting to the MySQL server on Azure.

[MySQL][ODBC 5.3(a) Driver]Can't connect to MySQL server

I have difficulty connecting to MySQL server from Tableau Server.
The error message is:
[MySQL][ODBC 5.3(a) Driver]
Can't connect to MySQL server on XYZ.
Unable to connect to the MySQL server "xyz".
Check that the server is running and that you have access privileges to the requested database
I have installed MySQL ODBC 5.3 Driver from tarball distribution in Ubuntu OS, and whitelisted the IP address of Tableau server in MySQL server.
What could be the possible causes for this? And is there any way that I check the ODBC connector was properly installed?
Any suggestion/comments are much appreciated!
Reasons, you could not connect could be different. But the error you've get asks you to check if server is running. It means, it could not find server.
The reasons, it could not find server, could be:
Server is down (Check its status by systemctl status mysql)
Server is not listening on some port your app connects to
Server is behind firewall (sudo ufw allow mysql command execution required to solve it in this case)
Your user does not have permissions to access that database, as it states in the error

Using aspnet_regsql.exe on a MySQL server intance

Has anybody had any success doing this?
I am referring to the following documentation
http://msdn.microsoft.com/en-us/library/x28wfk74%28v=vs.100%29.aspx
Here is my output:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regsql.exe -S localhost -U
root -P pwd -d aspnetdb -A all
Microsoft (R) ASP.NET SQL Registration Tool version 4.0.30319.18408
Administrative utility to install and uninstall ASP.NET features on a SQL server
.
Copyright (C) Microsoft Corporation. All rights reserved.
It worked fine last time I used it on a MSSQL Sever instance.
Start adding the following features:
Membership
Profile
RoleManager
Personalization
SqlWebEventProvider
.................
An error has occurred. Details of the exception:
A network-related or instance-specific error occurred while establishing a conne
ction to SQL Server. The server was not found or was not accessible. Verify that
the instance name is correct and that SQL Server is configured to allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not open a conne
ction to SQL Server)
Worked fine when I used it on a MSSQL server.

Excel VBA to connect to MySQL on linux server

I am trying to connect to MySQL database using VBA from my local machine. The database is in the linux server(XXXX.xxx.edu). I have the SSH client in my machine through which I connect to the *****.xxx.edu server. Once when I login and use the below command, I am able to access the MySQL database without any problem.
mysql -p -h XXXX.XXX.edu -u username dbname
However,I need to run the VBA in my machine and insert the values into this database. I tried to connect using the code mentioned in the below link.
Error in VBA:`[Microsoft][ODBC Manager] Data source name not found and no default driver specified
As told in the suggestion of the above link, I installed the MYSQL ODBC drivers which installed the MySQL 5.5 in my machine. Even after installing, I get the error,
[Microsoft][ODBC Manager] Data source name not found and no default driver specified
I am not able to figure out what exactly is the problem. How should I connect to the linux server and then connect to the MySQL database?
you install the mysql odbc driver (the msi) from here.
http://dev.mysql.com/downloads/connector/odbc/
you run ODBC Data Source Administrator
go to System DSN
click Add
select, for instance, MySql ODBC Unicode Driver
click finish.
dns name: fred
description: fred
tcpip server: 192.168.1.11 (whatever, dns, so long as u can point to it)
port 3306
user: root (whatever)
pwd: whatever works
drop down database, click test or view them

mySQL command line works but ODBC and workbench do not

I am trying to test a connection to a mySQL database running on a remote linux server. I am running Windows 7 and have mySQL installed on my machine as well as the 32-bit ODBC driver. I can connect from the DOS command prompt with no problems. But I cannot connect using mySQL workbench or with ODBC (from MS Access).
In MySQL workbench my error is:
Your connection attempt failed for user 'username' from your host to server at 'x.x.x.x:x': Unknown MySQL server host 'x.x.x.x' (0)
In MS Acess (ODBC driver) my error is:
Connection faile:[HY000][MySQL][ODBC 5.2(w) Driver]Can't connect to MySQL server on 'x.x.x.x' (10061)
I've searched stackoverflow extensively and I found lots of people who can't get ANY connection to work. But I know I can log in from my computer. Could it be something other than ports?
Please make sure you are using correct ip address in MySQL workbench to connect to your mysql database