{"id":3074,"date":"2022-04-06T12:49:59","date_gmt":"2022-04-06T05:49:59","guid":{"rendered":"https:\/\/www.sqlservertutorial.net\/?page_id=3074"},"modified":"2022-04-08T07:28:54","modified_gmt":"2022-04-08T00:28:54","slug":"sql-server-create-login","status":"publish","type":"page","link":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/","title":{"rendered":"SQL Server CREATE LOGIN"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to use the SQL Server <code>CREATE LOGIN<\/code> statement to create a login.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-sql-server-create-login-statement'>Introduction to the SQL Server CREATE LOGIN statement <a href=\"#introduction-to-the-sql-server-create-login-statement\" class=\"anchor\" id=\"introduction-to-the-sql-server-create-login-statement\" title=\"Anchor for Introduction to the SQL Server CREATE LOGIN statement\">#<\/a><\/h2>\n\n\n\n<p>Before creating a user that accesses the databases in an SQL Server, you need to follow these steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>First, create a login for SQL Server.<\/li><li>Second, <a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-user\/\">create a user<\/a> and map the user with the login.<\/li><\/ul>\n\n\n\n<p>To create a login, you use the <code>CREATE LOGIN<\/code> statement. The following shows the basic syntax of the <code>CREATE LOGIN<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN login_name \n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> = <span class=\"hljs-keyword\">password<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>First, specify the login name after the <code>CREATE LOGIN<\/code> keywords.<\/li><li>Second, specify the password in the <code>WITH PASSWORD<\/code> clause.<\/li><\/ul>\n\n\n\n<p>The password is case-sensitive. It needs to be between 8 and 128 characters and can include a-z, A-Z, 0-9, and most non-alphanumeric characters.<\/p>\n\n\n\n<p class=\"note\">Notice that the password cannot contain the <code>login_name<\/code> or single quotes.<\/p>\n\n\n\n<p>Internally, SQL Server stores the hash of the password using SHA-512. When you migrate a database, you can reuse the hashed passwords of the logins from the legacy database in the new database.<\/p>\n\n\n\n<p>To create a login with a hashed password, you specify the hashed password with the <code>HASHED<\/code> keyword like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN login_name \n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> = hashed_password HASHED;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For security reasons, you should use the hashed password for database migration purposes only.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='sql-server-create-login-statement-example'>SQL Server CREATE LOGIN statement example <a href=\"#sql-server-create-login-statement-example\" class=\"anchor\" id=\"sql-server-create-login-statement-example\" title=\"Anchor for SQL Server CREATE LOGIN statement example\">#<\/a><\/h2>\n\n\n\n<p>The following statement creates a new login called <code>bob<\/code> with the password <code>Ebe2di68.<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN bob\n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span>=<span class=\"hljs-string\">'Ebe2di68.'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The login <code>bob<\/code> can log in to the SQL Server, and view the database names, but cannot access any databases. <\/p>\n\n\n\n<p>To view all the logins of an SQL Server instance, you use the following query:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span>\n  sp.name <span class=\"hljs-keyword\">AS<\/span> login,\n  sp.type_desc <span class=\"hljs-keyword\">AS<\/span> login_type,\n  <span class=\"hljs-keyword\">CASE<\/span>\n    <span class=\"hljs-keyword\">WHEN<\/span> sp.is_disabled = <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">THEN<\/span> <span class=\"hljs-string\">'Disabled'<\/span>\n    <span class=\"hljs-keyword\">ELSE<\/span> <span class=\"hljs-string\">'Enabled'<\/span>\n  <span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">AS<\/span> <span class=\"hljs-keyword\">status<\/span>,\n  sl.password_hash,\n  sp.create_date,\n  sp.modify_date\n<span class=\"hljs-keyword\">FROM<\/span> sys.server_principals sp\n<span class=\"hljs-keyword\">LEFT<\/span> <span class=\"hljs-keyword\">JOIN<\/span> sys.sql_logins sl\n  <span class=\"hljs-keyword\">ON<\/span> sp.principal_id = sl.principal_id\n<span class=\"hljs-keyword\">WHERE<\/span> sp.type <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">IN<\/span> (<span class=\"hljs-string\">'G'<\/span>, <span class=\"hljs-string\">'R'<\/span>)\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> create_date <span class=\"hljs-keyword\">DESC<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1142\" height=\"146\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example.png\" alt=\"\" class=\"wp-image-3077\" srcset=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example.png 1142w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example-300x38.png 300w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example-768x98.png 768w\" sizes=\"auto, (max-width: 1142px) 100vw, 1142px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='sql-server-create-login-statement-options'>SQL Server CREATE LOGIN statement options <a href=\"#sql-server-create-login-statement-options\" class=\"anchor\" id=\"sql-server-create-login-statement-options\" title=\"Anchor for SQL Server CREATE LOGIN statement options\">#<\/a><\/h2>\n\n\n\n<p>Let&#8217;s discuss more options for the <code>CREATE LOGIN<\/code> statement.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='the-check_policyoption'>The CHECK_POLICY&nbsp;option <a href=\"#the-check_policyoption\" class=\"anchor\" id=\"the-check_policyoption\" title=\"Anchor for The CHECK_POLICY&nbsp;option\">#<\/a><\/h3>\n\n\n\n<p>The <code>CHECK_POLICY<\/code> option allows you to specify that the Windows password policies of the server on which the SQL Server is running should be applied to the login. The <code>CHECK_POLICY<\/code> can be <code>ON<\/code> or <code>OFF<\/code>. Its default value is <code>ON<\/code>.<\/p>\n\n\n\n<p>The following shows the <code>CREATE LOGIN<\/code> statement with the <code>CHECK_POLICY<\/code> option:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN login_name\n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> = <span class=\"hljs-keyword\">password<\/span>, \nCHECK_POLICY = {<span class=\"hljs-keyword\">ON<\/span> | <span class=\"hljs-keyword\">OFF<\/span>};<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note that the <code>CHECK_POLICY<\/code> option is applied to SQL Server logins only.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='the-check_expiration-option'>The CHECK_EXPIRATION option <a href=\"#the-check_expiration-option\" class=\"anchor\" id=\"the-check_expiration-option\" title=\"Anchor for The CHECK_EXPIRATION option\">#<\/a><\/h3>\n\n\n\n<p>The <code>CHECK_EXPIRATION<\/code> option determines whether the password expiration policy should be enforced on this login. The <code>CHECK_EXPIRATION<\/code> can be <code>ON<\/code> or <code>OFF<\/code>. The default value is <code>OFF<\/code>.<\/p>\n\n\n\n<p>The following shows the <code>CREATE LOGIN<\/code> statement with the <code>CHECK_EXPIRATION<\/code> option:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN login_name\n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> = <span class=\"hljs-keyword\">password<\/span>, \nCHECK_EXPIRATION = {<span class=\"hljs-keyword\">ON<\/span> | <span class=\"hljs-keyword\">OFF<\/span>};<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note that the <code>CHECK_EXPIRATION<\/code> option is applied to SQL Server logins only.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='the-must_change-option'>The MUST_CHANGE option <a href=\"#the-must_change-option\" class=\"anchor\" id=\"the-must_change-option\" title=\"Anchor for The MUST_CHANGE option\">#<\/a><\/h3>\n\n\n\n<p>To prompt the users for a new password the first time they log in, you use the <code>MUST_CHANGE<\/code> option. When you use the <code>MUST_CHANGE<\/code> option, the <code>CHECK_POLICY<\/code> and <code>CHECK_EXPIRATION<\/code> must be <code>ON<\/code>. Otherwise, the statement will fail.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN login_name\n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> = <span class=\"hljs-keyword\">password<\/span> MUST_CHANGE,\n     CHECK_POLICY=<span class=\"hljs-keyword\">ON<\/span>,\n     CHECK_EXPIRATION=<span class=\"hljs-keyword\">ON<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN alice\n<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> = <span class=\"hljs-string\">'UcxSj12.'<\/span> MUST_CHANGE,\n     CHECK_POLICY=<span class=\"hljs-keyword\">ON<\/span>, \n     CHECK_EXPRIATION=<span class=\"hljs-keyword\">ON<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, SQL Server will prompt the user who uses the <code>alice<\/code> login name for a new password the first time the user logs in.<\/p>\n\n\n\n<p>Note that the <code>MUST_CHANGE<\/code> option is applied to SQL Server logins only.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='creating-a-login-from-a-windows-domain-account'>Creating a login from a Windows domain account <a href=\"#creating-a-login-from-a-windows-domain-account\" class=\"anchor\" id=\"creating-a-login-from-a-windows-domain-account\" title=\"Anchor for Creating a login from a Windows domain account\">#<\/a><\/h2>\n\n\n\n<p>To create a login from a Windows domain account, you use the following statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN domain_name\\login_name\n<span class=\"hljs-keyword\">FROM<\/span> WINDOWS;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following example creates a login from the <code>sqlservertutorial\\peter<\/code> windows domain account:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> LOGIN sqlservertutorial\\peter\n<span class=\"hljs-keyword\">FROM<\/span> WINDOWS;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note that the <code>sqlservertutorial\\peter<\/code> windows domain account must exist.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Use the <code>CREATE LOGIN<\/code> statement to create a login for SQL Server.<\/li><\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"3074\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/\"\n\t\t\t\tdata-post-title=\"SQL Server CREATE LOGIN\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"3074\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/\"\n\t\t\t\tdata-post-title=\"SQL Server CREATE LOGIN\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to use the SQL Server CREATE LOGIN statement to create an account that can log in to the SQL Server.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2903,"menu_order":6,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3074","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQL Server Create Login<\/title>\n<meta name=\"description\" content=\"In this tutorial, you&#039;ll learn how to use the SQL Server CREATE LOGIN statement to create an account that can log in to the SQL Server.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server Create Login\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you&#039;ll learn how to use the SQL Server CREATE LOGIN statement to create an account that can log in to the SQL Server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Server Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-08T00:28:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/sql-server-create-login\\\/\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/sql-server-create-login\\\/\",\"name\":\"SQL Server Create Login\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/sql-server-create-login\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/sql-server-create-login\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/SQL-Server-CREATE-LOGIN-example.png\",\"datePublished\":\"2022-04-06T05:49:59+00:00\",\"dateModified\":\"2022-04-08T00:28:54+00:00\",\"description\":\"In this tutorial, you'll learn how to use the SQL Server CREATE LOGIN statement to create an account that can log in to the SQL Server.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/sql-server-create-login\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/sql-server-create-login\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/sql-server-create-login\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/SQL-Server-CREATE-LOGIN-example.png\",\"contentUrl\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/SQL-Server-CREATE-LOGIN-example.png\",\"width\":1142,\"height\":146},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/sql-server-create-login\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server Administration\",\"item\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-administration\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SQL Server CREATE LOGIN\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/#website\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/\",\"name\":\"SQL Server Tutorial\",\"description\":\"The Practical SQL Server Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Server Create Login","description":"In this tutorial, you'll learn how to use the SQL Server CREATE LOGIN statement to create an account that can log in to the SQL Server.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server Create Login","og_description":"In this tutorial, you'll learn how to use the SQL Server CREATE LOGIN statement to create an account that can log in to the SQL Server.","og_url":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/","og_site_name":"SQL Server Tutorial","article_modified_time":"2022-04-08T00:28:54+00:00","og_image":[{"url":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/","url":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/","name":"SQL Server Create Login","isPartOf":{"@id":"https:\/\/www.sqlservertutorial.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/#primaryimage"},"image":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example.png","datePublished":"2022-04-06T05:49:59+00:00","dateModified":"2022-04-08T00:28:54+00:00","description":"In this tutorial, you'll learn how to use the SQL Server CREATE LOGIN statement to create an account that can log in to the SQL Server.","breadcrumb":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/#primaryimage","url":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example.png","contentUrl":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-CREATE-LOGIN-example.png","width":1142,"height":146},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/sql-server-create-login\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlservertutorial.net\/"},{"@type":"ListItem","position":2,"name":"SQL Server Administration","item":"https:\/\/www.sqlservertutorial.net\/sql-server-administration\/"},{"@type":"ListItem","position":3,"name":"SQL Server CREATE LOGIN"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlservertutorial.net\/#website","url":"https:\/\/www.sqlservertutorial.net\/","name":"SQL Server Tutorial","description":"The Practical SQL Server Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlservertutorial.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/3074","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/comments?post=3074"}],"version-history":[{"count":5,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/3074\/revisions"}],"predecessor-version":[{"id":3110,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/3074\/revisions\/3110"}],"up":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/2903"}],"wp:attachment":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/media?parent=3074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}