Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Set password for a SQL database ? [modified]

Set password for a SQL database ? [modified]

Scheduled Pinned Locked Moved Database
databasequestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohammad Dayyan
    wrote on last edited by
    #1

    Hi. In MS Access we can set password for a database. Can we set password for a SQL database(*.mdf)? if so, could you please say How? Thanks in advance.

    modified on Monday, September 28, 2009 11:21 PM

    A 1 Reply Last reply
    0
    • M Mohammad Dayyan

      Hi. In MS Access we can set password for a database. Can we set password for a SQL database(*.mdf)? if so, could you please say How? Thanks in advance.

      modified on Monday, September 28, 2009 11:21 PM

      A Offline
      A Offline
      Andy_L_J
      wrote on last edited by
      #2

      USE master
      Go

      EXEC sp_addlogin NewUser, password, dbName
      Go

      Where NewUser is the User Name, password is the user password, and dbName is the name of the database that you want to add the user to. Or, if you are using Windows authentication, add users to roles in SSMS.

      I don't speak Idiot - please talk slowly and clearly I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury Driven to the arms of Heineken by the wife

      R 1 Reply Last reply
      0
      • A Andy_L_J

        USE master
        Go

        EXEC sp_addlogin NewUser, password, dbName
        Go

        Where NewUser is the User Name, password is the user password, and dbName is the name of the database that you want to add the user to. Or, if you are using Windows authentication, add users to roles in SSMS.

        I don't speak Idiot - please talk slowly and clearly I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury Driven to the arms of Heineken by the wife

        R Offline
        R Offline
        r a m e s h
        wrote on last edited by
        #3

        The above method is to add user login to the database. But the OP is asking to set user id and password to the .MDF file as we can do it for MS Access files. AFAIK, We cannot set user id and password to the database files(.MDF and .LDF).

        A 1 Reply Last reply
        0
        • R r a m e s h

          The above method is to add user login to the database. But the OP is asking to set user id and password to the .MDF file as we can do it for MS Access files. AFAIK, We cannot set user id and password to the database files(.MDF and .LDF).

          A Offline
          A Offline
          Andy_L_J
          wrote on last edited by
          #4

          dotnet buddy wrote:

          AFAIK, We cannot set user id and password to the database files(.MDF and .LDF).

          Correct.

          I don't speak Idiot - please talk slowly and clearly I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury Driven to the arms of Heineken by the wife

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups