Share via

SqlLocalDB not recognized after installation using powershell command

Manjunath 6 Reputation points
2022-07-22T17:13:00.783+00:00

when I run these below commands one after another in a same powershell window , we are getting below error.
And it is working when we run the second command in a new powershell window.

step 1: MsiExec.exe /i SqlLocalDB.msi IACCEPTSQLLOCALDBLICENSETERMS=YES /qn | Out-Null

step 2: sqlocaldb info

error : sqllocaldb : The term 'sqllocaldb' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • sqllocaldb info
  • ~~~~~~~~~~
  • CategoryInfo : ObjectNotFound: (sqllocaldb:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException

Any help would be appreciated to run these command in the same batch :)

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


3 answers

Sort by: Most helpful
  1. Manjunath 6 Reputation points
    2022-07-27T12:25:43.163+00:00

    Reload the environment variables

    Was this answer helpful?

    1 person found this answer helpful.

  2. YufeiShao-msft 7,156 Reputation points
    2022-07-25T08:18:10.13+00:00

    Hi @Manjunath

    You can first try to see if you can find SqlLocalDB in C:\Program Files\Microsoft SQL Server\nnn\Tools\Binn (by default).
    Please find where it is in your system and try to open the command line at this loaction, and run this command to add that location to your PATH
    use 'cd' command in CMD and use SqlLocalDB.exe in this dictionary.

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  3. Erland Sommarskog 134.4K Reputation points MVP Volunteer Moderator
    2022-07-22T21:58:47.317+00:00

    Have you made sure that the location for sqllocaldb is in your PATH? It does not seem like that.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.