{"id":13264,"date":"2023-07-22T06:13:36","date_gmt":"2023-07-22T10:13:36","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=13264"},"modified":"2023-07-22T06:13:40","modified_gmt":"2023-07-22T10:13:40","slug":"how-to-set-up-a-new-mysql-user-account","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/","title":{"rendered":"How to set up a new MySQL User Account"},"content":{"rendered":"\n

To set up a MySQL user account, you’ll need access to the MySQL server with appropriate administrative privileges, such as the root<\/code> user or an account with CREATE USER<\/code> and GRANT<\/code> privileges. Here’s a step-by-step guide on how to create a new user account in MySQL<\/a>:<\/p>\n\n\n\n

Connect to MySQL Server<\/strong><\/h2>\n\n\n\n

Open a terminal or Command Prompt and log in to the MySQL server as a user with administrative privileges. You can use the following command and enter the password when prompted:<\/p>\n\n\n\n

$mysql -u root -p<\/code><\/pre>\n\n\n\n

Create a new MySQL User<\/strong><\/h2>\n\n\n\n

Once you’re logged in to the MySQL server, you can create a new user using the CREATE USER<\/code> statement. Replace new_user<\/code> with the desired username, and password<\/code> with the password you want to set for the user (replace user_password<\/code> with the actual password):<\/p>\n\n\n\n

mysql> CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'user_password';<\/code><\/pre>\n\n\n\n

The 'localhost'<\/code> part indicates that this user can only connect from the local machine. If you want the user to be able to connect from any host (not recommended for security reasons), you can use '%'<\/code> instead of 'localhost'<\/code>.<\/p>\n\n\n\n

Grant Privileges to the MySQL User<\/strong><\/h2>\n\n\n\n

After creating the user, you need to grant appropriate privileges to the user for the databases or tables they should access. For example, to grant all privileges on a specific database to the new user, you can use the GRANT<\/code> statement:<\/p>\n\n\n\n

mysql> GRANT ALL PRIVILEGES ON your_database_name.* TO 'new_user'@'localhost';<\/code><\/pre>\n\n\n\n

Replace your_database_name<\/code> with the name of the database you want to grant access to.<\/p>\n\n\n\n

If you want to grant different sets of privileges or restrict access to specific tables, you can modify the privileges accordingly. For example, to grant only SELECT<\/code> privileges, you can use:<\/p>\n\n\n\n

mysql> GRANT SELECT ON your_database_name.your_table_name TO 'new_user'@'localhost';<\/code><\/pre>\n\n\n\n

Apply Changes and Refresh Privileges<\/strong><\/h2>\n\n\n\n

After creating the user and granting privileges, apply the changes and refresh MySQL privileges for them to take effect:<\/p>\n\n\n\n

mysql> FLUSH PRIVILEGES;<\/code><\/pre>\n\n\n\n

Exit the MySQL Client<\/strong><\/h2>\n\n\n\n

Once you have created the user and granted the necessary privileges, you can exit the MySQL client by typing:<\/p>\n\n\n\n

mysql> EXIT;<\/code><\/pre>\n\n\n\n

That’s it! The new user account is now set up in MySQL with the specified privileges. They can use the provided credentials to connect to the MySQL server and access the granted resources. Remember to follow best practices for securing your MySQL server and creating strong passwords for user accounts.<\/p>\n","protected":false},"excerpt":{"rendered":"

To set up a MySQL user account, you’ll need access to the MySQL server with appropriate administrative privileges, such as the root user or an account with CREATE USER and…<\/p>\n","protected":false},"author":1,"featured_media":13265,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,16,18],"tags":[180,193,350,393,433,591],"yoast_head":"\nHow to set up a new MySQL User Account<\/title>\n<meta name=\"description\" content=\"Follow these steps to create a new MySQL user account and learn how to set and restrict permissions on the user that you created\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to set up a new MySQL User Account\" \/>\n<meta property=\"og:description\" content=\"Follow these steps to create a new MySQL user account and learn how to set and restrict permissions on the user that you created\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/\" \/>\n<meta property=\"og:site_name\" content=\"Brightwhiz.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/brightwhiz\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-22T10:13:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-22T10:13:40+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Bright\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:site\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Bright\" \/>\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\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"How to set up a new MySQL User Account\",\"datePublished\":\"2023-07-22T10:13:36+00:00\",\"dateModified\":\"2023-07-22T10:13:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/\"},\"wordCount\":355,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg\",\"keywords\":[\"Database\",\"DevOps\",\"Libraries\",\"MySQL\",\"Optimization\",\"Tools\"],\"articleSection\":[\"Articles\",\"Guides\",\"How To\",\"Technology\",\"Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/\",\"url\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/\",\"name\":\"How to set up a new MySQL User Account\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg\",\"datePublished\":\"2023-07-22T10:13:36+00:00\",\"dateModified\":\"2023-07-22T10:13:40+00:00\",\"description\":\"Follow these steps to create a new MySQL user account and learn how to set and restrict permissions on the user that you created\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#primaryimage\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg\",\"width\":1280,\"height\":680,\"caption\":\"new MySQL User Account\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to set up a new MySQL User Account\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/local.brightwhiz\/#website\",\"url\":\"http:\/\/local.brightwhiz\/\",\"name\":\"Brightwhiz.com\",\"description\":\"Best Tech guides, Tutorials, and News\",\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/local.brightwhiz\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/local.brightwhiz\/#organization\",\"name\":\"Brightwhiz\",\"url\":\"http:\/\/local.brightwhiz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"width\":706,\"height\":135,\"caption\":\"Brightwhiz\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/brightwhiz\/\",\"https:\/\/x.com\/brightwhizmag\",\"https:\/\/instagram.com\/bright_whiz\/\",\"https:\/\/www.pinterest.com\/sobbayi\/\",\"https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\",\"name\":\"Michael Bright\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"caption\":\"Michael Bright\"},\"sameAs\":[\"https:\/\/sobbayi.com\"],\"url\":\"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to set up a new MySQL User Account","description":"Follow these steps to create a new MySQL user account and learn how to set and restrict permissions on the user that you created","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":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/","og_locale":"en_US","og_type":"article","og_title":"How to set up a new MySQL User Account","og_description":"Follow these steps to create a new MySQL user account and learn how to set and restrict permissions on the user that you created","og_url":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2023-07-22T10:13:36+00:00","article_modified_time":"2023-07-22T10:13:40+00:00","og_image":[{"width":1280,"height":680,"url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg","type":"image\/jpeg"}],"author":"Michael Bright","twitter_card":"summary_large_image","twitter_creator":"@brightwhizmag","twitter_site":"@brightwhizmag","twitter_misc":{"Written by":"Michael Bright","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"How to set up a new MySQL User Account","datePublished":"2023-07-22T10:13:36+00:00","dateModified":"2023-07-22T10:13:40+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/"},"wordCount":355,"commentCount":0,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"image":{"@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg","keywords":["Database","DevOps","Libraries","MySQL","Optimization","Tools"],"articleSection":["Articles","Guides","How To","Technology","Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/","url":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/","name":"How to set up a new MySQL User Account","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"primaryImageOfPage":{"@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#primaryimage"},"image":{"@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg","datePublished":"2023-07-22T10:13:36+00:00","dateModified":"2023-07-22T10:13:40+00:00","description":"Follow these steps to create a new MySQL user account and learn how to set and restrict permissions on the user that you created","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#primaryimage","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2023\/07\/new-MySQL-User-Account.jpg","width":1280,"height":680,"caption":"new MySQL User Account"},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/how-to-set-up-a-new-mysql-user-account\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"How to set up a new MySQL User Account"}]},{"@type":"WebSite","@id":"http:\/\/local.brightwhiz\/#website","url":"http:\/\/local.brightwhiz\/","name":"Brightwhiz.com","description":"Best Tech guides, Tutorials, and News","publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/local.brightwhiz\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/local.brightwhiz\/#organization","name":"Brightwhiz","url":"http:\/\/local.brightwhiz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","width":706,"height":135,"caption":"Brightwhiz"},"image":{"@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/brightwhiz\/","https:\/\/x.com\/brightwhizmag","https:\/\/instagram.com\/bright_whiz\/","https:\/\/www.pinterest.com\/sobbayi\/","https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ"]},{"@type":"Person","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32","name":"Michael Bright","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","caption":"Michael Bright"},"sameAs":["https:\/\/sobbayi.com"],"url":"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/"}]}},"_links":{"self":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/13264"}],"collection":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/comments?post=13264"}],"version-history":[{"count":0,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/13264\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media\/13265"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=13264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=13264"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=13264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}