Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if MYSQL fails to create a new user?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

We often use the additional database method to quickly restore the database content when we migrate the MSSQL database. Simple and fast. But when I want to set up users to manage the database, I will find out. There is a prompt error:

Here, let's find out what the problem is!

First of all, we can look at the configuration of the database of the server we attached, and we check its properties.

When we look at the permissions in the properties, we will find that there is a user here.

But when we look at the user in the login in database security, we find that the user does not exist.

A noun may be used here as' isolated user'.

Explain the term here: an orphaned account, which means that an account in a database has only a user name and no login name, and such a user exists in the sysusers system table of the user base, but there is no corresponding record in the syslogins of the master database.

Isolated accounts are generally generated in the following two ways:

1. Restore the backed-up database on another machine

two。 Only the user library was restored after reinstalling the system or SQL SERVER

When the problem is found, let's solve it:

Solution method

1. First, we create a login name that matches that database record, but do not set permissions, that is, user mapping does not operate.

2. Open the new query

3. Use the command to associate the user in the database with the user with the login name

Use database name

Go

Sp_change_users_login 'update_one',' user name', 'login name'

After execution, we check the user mapping and find that the corresponding database permissions are automatically set.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report