User permissions in remote SQL Server - sql-server

I have connection with my database in SQL Server Management Studio from remote server somee.com. I want to change permissions for user (security -> users) and add permissions to update, insert. Every permission I add
is disappearing if I reopen the window database user
What's the problem? I can't edit data :(

Related

Moved database to new instance - permission issues

I had to upgrade SQL server Express from 2017 to 2019. I have some tables that I backed up from the old instance and restored to the new instance. I then recreated the user I needed in the new instance with the same privileges. It seems I can login as that user but I cannot access the table.
If I try to edit that user's table privileges in "NewInstanceName -> Logins -> UserName" I get the message"
Create failed for User 'toolLocation'. (Microsoft.SqlServer.Smo)
User, group, or role 'toolLocation' already exists in the current
database. (Microsoft SQL Server, Error: 15023)
How do I resolve this?

Cannot create a new database in Sql Server - changed username

I installed Sql Server on a server in a company I used to work for.
I left the company - and rejoined a year later - and now I have a different domain login.
I've logged on to the server again, and in SSMS tried to create a new database - however I get the error:
create database permission denied in database 'master'
I have tried changing permission and adding DBCreator to BuiltInUsers and to SA - and also tried adding my new domain name to the security section - but when I try to add DBCreator to my user name, I get the error:
Cannot alter the server role 'dbcreator' because it does not exist or you do not have permission
Is there any way I can take control of the Sql Server instance again, to allow me to create new databases?
Thanks for any help,
Mark
I faced this problem when I made another SQL user which I login with, and I tried to give this user [dbcreator] grant.
I solved this via
runnig sql server as administrator
switching to my windows authentication.
going to folder Security -> Logins and double click on my new sql login user.
selecting Server roles and give grant to my user.

Cannot add user to SQL Server 2012 database

I am trying to add a user to SQL Server 2012 Express by right clicking the users folder and clicking add.
I am selecting "SQL user with login" and filling out login info but it is giving me this error:
I am running Windows Web Server 2008 R2. I have tried different names in case it was conflicting and no joy. There is already a user in another database that someone else added previously. I tried to add a user to that database and got the same error so I am not sure what they did differently to me.
I tried running SQL Server Management Studio as administrator but when I do that the add user dialog changes and only lets me create windows user, no sql with login option is there.
I have also tried with a query:
CREATE LOGIN loginname
WITH PASSWORD = 'pass'
It says it is completed successfully but no user is created.
Anyone know what I am doing wrong?
You need to create a login to the server, then a user in the database.
Create Login
Create Database User
If you successfully created loginname, at the server level folder in SSMS, double click on the login and you will see options to grant the user permissions to the necessary database as well as assign a server level role. Once the login is configured and you have given permissions to the database, you can look in the User folder of the database and see the user.
Also answered in:
How do I create a new user in SQL Server 2012 that I can use in a connection string?
Does your SQL user you're logging in with have priv to create a user? This is not the same as launching the application with an elevation (right clicking the shortcut, and clicking run as administrator).

Problem restoring a SQL Server backup

I have a SQL Server 2008, which is part of a domain. Now I make a backup of a database of this server and restore it on a SQL Server, which is not part of a domain.
I have an C# application, which uses this database. On the NON-Domain machine I get now exceptions like this:
"Cannot execute as the database prinzipal because the principial "dbo" does not exist, this type of principal cannot be impersonatedm or you don not have the permission"
I think, the problem is, that the database owner is a domain user and this user doesn't exist on the target machine (backup machine)!? How can I solve this ?
The MS SQL server follows a 2 layer user system.
You must make sure that your login is an actual login on the SQL Server (this refers to the SQL Server itself NOT to the actual database).
You find the SQL Server users in the Management Studio under:
Server root -> Security - Logins
After you ensured that your login is available you have to map it to a user/schema. In Order todo so you must:
Select the SQL Server user you want to map
Right click on the user
Select properties
Switch to the User Mapping tab
Choose the database you want to create a mapping for
Select the Database user you want to associate the currently selected SQL Server user with
Done

SQL Server 2008 can't login with newly created user

I'm using using Windows Vista and I'm having trouble logging in with a newly created user.
I open SQL Server Management Studio.
I create a new Login by right-clicking on Security->Logins.
Check: SQL Server Authentication
Login name: tester
Password: test
Click OK
I added this user to User Mapping to my database of choice.
Click File -> Connect Object Explorer, select SQL Server Authentication and enter tester/test and click Connect.
I get an error:
Login failed for user 'tester'. (Microsoft SQL Server, Error: 18456"
with Severity = 14 and State = 1.
What causes this error and how do I login with my user?
SQL Server was not configured to allow mixed authentication.
Here are steps to fix:
Right-click on SQL Server instance at root of Object Explorer, click on Properties
Select Security from the left pane.
Select the SQL Server and Windows Authentication mode radio button, and click OK.
Right-click on the SQL Server instance, select Restart (alternatively, open up Services and restart the SQL Server service).
This is also incredibly helpful for IBM Connections users, my wizards were not able to connect until I fxed this setting.
If you haven't restarted your SQL database Server after you make login changes, then make sure you do that. Start->Programs->Microsoft SQL Server -> Configuration tools -> SQL Server configuration manager -> Restart Server.
It looks like you only added the user to the server. You need to add them to the database too. Either open the database/Security/User/Add New User or open the server/Security/Logins/Properties/User Mapping.
You'll likely need to check the SQL Server error logs to determine the actual state (it's not reported to the client for security reasons.) See here for details.
Login to Server as Admin
Go To Security > Logins > New Login
Step 1:
Login Name : SomeName
Step 2:
Select SQL Server / Windows Authentication.
More Info on,
what is the differences between sql server authentication and windows authentication..?
Choose Default DB and Language of your choice
Click OK
Try to connect with the New User Credentials, It will prompt you to change the password. Change and login
OR
Try with query :
USE [master] -- Default DB
GO
CREATE LOGIN [Username] WITH PASSWORD=N'123456', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=ON, CHECK_POLICY=ON
GO
--123456 is the Password And Username is Login User
ALTER LOGIN [Username] enable -- Enable or to Disable User
GO

Resources