I had installed SQL Server 2008 R2 "SQL Server Database Engine" in virtual machine and I want to connect to it over odbc from other computer (Linux).
I hadn't installed management studio as I wanted minimal possible installation (it is mostly for very basic testing purposes not for real work).
I hadn't installed Management Studio and I don't want to install it.
During installation procedure I provided a user and password for connection however, looks like thing went wrong and I can't login using this user.
Situation:
- I have installed "Database Engine" and configured TCP connection
- I can connect to it using isql but it reports that user does not exist.
- I see in Event Log (of Windows) complains that user does not exist.
- I've tried to run import tool and managed to login using XP user on same PC
and could run simple queries, however this tool does not allow me to run a
statement so I can't run
CREATE LOGIN user-name WITH PASSWORD='secret'
.
How can I connect to this database and add new users?
Basically at this point I have two options:
Reinstall database, but:
I don't want to and nothing promises that this time it would work and create a user.
Install management studio I don't want it is huge install for virtual machine.
Question:
Is there any simple command line tool to access DB in place just to run several statements using XP authentication without a huge Management studio tool?
Solution Summary:
- Use
sqlcmd -Q "create login ..."
to run sql statements I need.sqlcmd.exe
is installed with "SQL Server Database Engine" - My user wasn't defined correctly during the installation because MS SQL didn't like my password I had given and it didn't alert me on the problem...