{"id":575,"date":"2021-08-26T18:53:34","date_gmt":"2021-08-26T18:53:34","guid":{"rendered":"https:\/\/cyberchunk.com\/?p=575"},"modified":"2023-08-07T10:22:02","modified_gmt":"2023-08-07T10:22:02","slug":"create-superuser-mysql-8","status":"publish","type":"post","link":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/","title":{"rendered":"How to create a superuser in MySQL 8?"},"content":{"rendered":"\n<p>create a new user in MySQL and make it a superuser with root-like access to the databases.<\/p>\n\n\n\n<p><strong>1. First, you have to log in with the root user, which has the CREATE USER privilege<\/strong><\/p>\n\n\n\n<p>Run this command to create a new user with a password:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'username'@'localhost' IDENTIFIED BY 'the_password';<\/code><\/pre>\n\n\n\n<p>At this point, the new user has no permission over the databases. The next thing to do is to grant privileges to the new user. There are several privileges a user can have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>ALL PRIVILEGES<\/strong>&nbsp;&#8211; a full root access to the databases. If no database is specified, it has global access across the system.<\/li>\n\n\n\n<li><strong>CREATE<\/strong>&nbsp;&#8211; create new tables or databases<\/li>\n\n\n\n<li><strong>DROP<\/strong>&nbsp;&#8211; delete tables or databases<\/li>\n\n\n\n<li><strong>DELETE<\/strong>&nbsp;&#8211; delete rows from tables<\/li>\n\n\n\n<li><strong>INSERT<\/strong>&nbsp;&#8211; insert rows into tables<\/li>\n\n\n\n<li><strong>SELECT<\/strong>&nbsp;&#8211; use the&nbsp;SELECT&nbsp;command to read through databases<\/li>\n\n\n\n<li><strong>UPDATE<\/strong>&nbsp;&#8211; update table rows<\/li>\n\n\n\n<li><strong>GRANT OPTION<\/strong>&nbsp;&#8211; grant or remove other users\u2019 privileges<\/li>\n<\/ul>\n\n\n\n<p><strong>2. Make it a superuser<\/strong><\/p>\n\n\n\n<p>To make this new user a superuser, we have to provide it with full root access to everything in the database, which means to GRANT ALL PRIVILEGES:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'localhost' WITH GRANT OPTION;\n<\/code><\/pre>\n\n\n\n<p>It\u2019s done, the new user now has the root-like permission.<\/p>\n\n\n\n<p><strong>3. Then create another account for the same new username<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'username'@'%' IDENTIFIED BY 'the_password';\n<\/code><\/pre>\n\n\n\n<p>And grant full root access:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;\n<\/code><\/pre>\n\n\n\n<p>Both&nbsp;<code>'username'@'localhost'<\/code>&nbsp;and&nbsp;<code>'username'@'%'<\/code>&nbsp;are superuser accounts with full privileges to do anything.<\/p>\n\n\n\n<p>The&nbsp;<code>'username'@'localhost'<\/code>&nbsp;the account can be used only when connecting from the local host. The&nbsp;<code>'username'@'%'<\/code>&nbsp;account uses the&nbsp;<code>'%'<\/code>&nbsp;wildcard for the host part, so it can be used to connect from any host.<\/p>\n\n\n\n<p><strong>4. To double check the privileges given to the new user, run&nbsp;<code>SHOW GRANTS<\/code>&nbsp;command:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SHOW GRANTS FOR username;\n<\/code><\/pre>\n\n\n\n<p><strong>5. Finally, when everything is settled, reload all the privileges:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FLUSH PRIVILEGES;\n<\/code><\/pre>\n\n\n\n<p>And all the changes will take effect immediately.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>create a new user in MySQL and make it a superuser with root-like access to the databases. 1. First, you have to log in with &hellip;<\/p>\n","protected":false},"author":1,"featured_media":577,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[85],"class_list":["post-575","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-infra-benchmarks","tag-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v18.5 (Yoast SEO v25.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Create a Superuser in MySQL 8: Step-by-Step Guide<\/title>\n<meta name=\"description\" content=\"Learn the step-by-step process to create a superuser in MySQL 8 for enhanced database management and administrative privileges.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create a superuser in MySQL 8?\" \/>\n<meta property=\"og:description\" content=\"Learn the step-by-step process to create a superuser in MySQL 8 for enhanced database management and administrative privileges.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/\" \/>\n<meta property=\"og:site_name\" content=\"Pracoda Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cyberchunkin\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-26T18:53:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-07T10:22:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"399\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"prakash\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"prakash\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/\"},\"author\":{\"name\":\"prakash\",\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/person\/758a6d1f2973de0cff80453cd6eb299e\"},\"headline\":\"How to create a superuser in MySQL 8?\",\"datePublished\":\"2021-08-26T18:53:34+00:00\",\"dateModified\":\"2023-08-07T10:22:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/\"},\"wordCount\":305,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/pracoda.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png\",\"keywords\":[\"mysql\"],\"articleSection\":[\"Infra Benchmarks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/\",\"url\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/\",\"name\":\"How to Create a Superuser in MySQL 8: Step-by-Step Guide\",\"isPartOf\":{\"@id\":\"https:\/\/pracoda.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png\",\"datePublished\":\"2021-08-26T18:53:34+00:00\",\"dateModified\":\"2023-08-07T10:22:02+00:00\",\"description\":\"Learn the step-by-step process to create a superuser in MySQL 8 for enhanced database management and administrative privileges.\",\"breadcrumb\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#primaryimage\",\"url\":\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png\",\"contentUrl\":\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png\",\"width\":800,\"height\":399},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/pracoda.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create a superuser in MySQL 8?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/pracoda.com\/blog\/#website\",\"url\":\"https:\/\/pracoda.com\/blog\/\",\"name\":\"Pracoda Technologies\",\"description\":\"Unveiling the Digital Landscape: Navigating Tech, Scams, and Societal Shifts\",\"publisher\":{\"@id\":\"https:\/\/pracoda.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/pracoda.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/pracoda.com\/blog\/#organization\",\"name\":\"CyberChunk\",\"url\":\"https:\/\/pracoda.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cyberchunk.com\/wp-content\/uploads\/2023\/08\/CyberChunk-Logos-1-1.png\",\"contentUrl\":\"https:\/\/cyberchunk.com\/wp-content\/uploads\/2023\/08\/CyberChunk-Logos-1-1.png\",\"width\":1409,\"height\":293,\"caption\":\"CyberChunk\"},\"image\":{\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/cyberchunkin\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/person\/758a6d1f2973de0cff80453cd6eb299e\",\"name\":\"prakash\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/af9d52a696766d27b7ffcff0321f8743973b88cbd4c13d9594dfc0d4744913c3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/af9d52a696766d27b7ffcff0321f8743973b88cbd4c13d9594dfc0d4744913c3?s=96&d=mm&r=g\",\"caption\":\"prakash\"},\"description\":\"The proactive Magento developer, DevOps expert, and e-commerce consultant behind Pracoda Technologies is the driving force behind our commitment to delivering excellence in software solutions. With a diverse skill set, strategic mindset, and collaborative approach, our leadership ensures we remain at the forefront of innovation, consistently propelling clients toward success and customer satisfaction as we navigate the ever-evolving e-commerce landscape.\",\"sameAs\":[\"https:\/\/cyberchunk.com\"],\"knowsAbout\":[\"CyberSecurity\"],\"knowsLanguage\":[\"English\"],\"jobTitle\":\"Senior Software Enginner\",\"worksFor\":\"Pracoda Technologies\",\"url\":\"https:\/\/pracoda.com\/blog\/author\/prakash\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Create a Superuser in MySQL 8: Step-by-Step Guide","description":"Learn the step-by-step process to create a superuser in MySQL 8 for enhanced database management and administrative privileges.","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:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/","og_locale":"en_US","og_type":"article","og_title":"How to create a superuser in MySQL 8?","og_description":"Learn the step-by-step process to create a superuser in MySQL 8 for enhanced database management and administrative privileges.","og_url":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/","og_site_name":"Pracoda Technologies","article_publisher":"https:\/\/www.facebook.com\/cyberchunkin\/","article_published_time":"2021-08-26T18:53:34+00:00","article_modified_time":"2023-08-07T10:22:02+00:00","og_image":[{"width":800,"height":399,"url":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png","type":"image\/png"}],"author":"prakash","twitter_card":"summary_large_image","twitter_misc":{"Written by":"prakash","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#article","isPartOf":{"@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/"},"author":{"name":"prakash","@id":"https:\/\/pracoda.com\/blog\/#\/schema\/person\/758a6d1f2973de0cff80453cd6eb299e"},"headline":"How to create a superuser in MySQL 8?","datePublished":"2021-08-26T18:53:34+00:00","dateModified":"2023-08-07T10:22:02+00:00","mainEntityOfPage":{"@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/"},"wordCount":305,"commentCount":0,"publisher":{"@id":"https:\/\/pracoda.com\/blog\/#organization"},"image":{"@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#primaryimage"},"thumbnailUrl":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png","keywords":["mysql"],"articleSection":["Infra Benchmarks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/","url":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/","name":"How to Create a Superuser in MySQL 8: Step-by-Step Guide","isPartOf":{"@id":"https:\/\/pracoda.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#primaryimage"},"image":{"@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#primaryimage"},"thumbnailUrl":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png","datePublished":"2021-08-26T18:53:34+00:00","dateModified":"2023-08-07T10:22:02+00:00","description":"Learn the step-by-step process to create a superuser in MySQL 8 for enhanced database management and administrative privileges.","breadcrumb":{"@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#primaryimage","url":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png","contentUrl":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/08\/create-mysql-user-accounts-and-grant-privileges.png","width":800,"height":399},{"@type":"BreadcrumbList","@id":"https:\/\/pracoda.com\/blog\/create-superuser-mysql-8\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pracoda.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to create a superuser in MySQL 8?"}]},{"@type":"WebSite","@id":"https:\/\/pracoda.com\/blog\/#website","url":"https:\/\/pracoda.com\/blog\/","name":"Pracoda Technologies","description":"Unveiling the Digital Landscape: Navigating Tech, Scams, and Societal Shifts","publisher":{"@id":"https:\/\/pracoda.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pracoda.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pracoda.com\/blog\/#organization","name":"CyberChunk","url":"https:\/\/pracoda.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pracoda.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cyberchunk.com\/wp-content\/uploads\/2023\/08\/CyberChunk-Logos-1-1.png","contentUrl":"https:\/\/cyberchunk.com\/wp-content\/uploads\/2023\/08\/CyberChunk-Logos-1-1.png","width":1409,"height":293,"caption":"CyberChunk"},"image":{"@id":"https:\/\/pracoda.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cyberchunkin\/"]},{"@type":"Person","@id":"https:\/\/pracoda.com\/blog\/#\/schema\/person\/758a6d1f2973de0cff80453cd6eb299e","name":"prakash","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pracoda.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/af9d52a696766d27b7ffcff0321f8743973b88cbd4c13d9594dfc0d4744913c3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/af9d52a696766d27b7ffcff0321f8743973b88cbd4c13d9594dfc0d4744913c3?s=96&d=mm&r=g","caption":"prakash"},"description":"The proactive Magento developer, DevOps expert, and e-commerce consultant behind Pracoda Technologies is the driving force behind our commitment to delivering excellence in software solutions. With a diverse skill set, strategic mindset, and collaborative approach, our leadership ensures we remain at the forefront of innovation, consistently propelling clients toward success and customer satisfaction as we navigate the ever-evolving e-commerce landscape.","sameAs":["https:\/\/cyberchunk.com"],"knowsAbout":["CyberSecurity"],"knowsLanguage":["English"],"jobTitle":"Senior Software Enginner","worksFor":"Pracoda Technologies","url":"https:\/\/pracoda.com\/blog\/author\/prakash\/"}]}},"_links":{"self":[{"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/posts\/575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/comments?post=575"}],"version-history":[{"count":2,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/posts\/575\/revisions"}],"predecessor-version":[{"id":732,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/posts\/575\/revisions\/732"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/media\/577"}],"wp:attachment":[{"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/media?parent=575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/categories?post=575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/tags?post=575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}