{"id":3469,"date":"2019-01-23T18:14:37","date_gmt":"2019-01-23T12:44:37","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=3469"},"modified":"2019-01-24T16:49:45","modified_gmt":"2019-01-24T11:19:45","slug":"create-a-new-user-and-grant-permissions-in-mysql","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/create-a-new-user-and-grant-permissions-in-mysql\/","title":{"rendered":"Create a New User and Grant Permissions in MySQL"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\" id=\"mce_1\">Date posted : 23\/01\/2019<\/h5>\n\n\n\n<h4 class=\"wp-block-heading\">Create a New User and Grant Permissions in MySQL<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>MySQL<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation.<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1:&nbsp;<\/strong>A new user can be created within the MySQL shell, using the following statement:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>CREATE USER '<strong>pheonix<\/strong>'@'localhost' IDENTIFIED BY '<strong>password<\/strong>';<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This will create a new user named \u2018pheonix\u2019 without any permissions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2:<\/strong> To give full access to all databases for the pheonix user, run the following statement:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>GRANT ALL PRIVILEGES ON * . * TO '<strong>pheonix<\/strong>'@'localhost';<\/code><br><br><strong>Step 3:<\/strong>Then run following statement to reload all the privileges:<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>FLUSH PRIVILEGES;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 4:&nbsp;<\/strong>To give access to a specific database for the new user, run the following statement:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>GRANT ALL PRIVILEGES ON&nbsp;<strong>database<\/strong>&nbsp;. * TO '<strong>pheonix<\/strong>'@'localhost';<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 5: <\/strong>To revoke access:<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>REVOKE&nbsp;ALL PRIVILEGES ON&nbsp;<strong>database<\/strong>.* FROM '<strong>pheonix<\/strong>'@'localhost';<\/code><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you! for using <a href=\"https:\/\/pheonixsolutions.com\/\">PHEONIX SOLUTIONS.<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You find this tutorial helpful? Share with your friends to keep it alive. Be the first to comment, we value your suggestions. For further queries please comment below. <br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Date posted : 23\/01\/2019 Create a New User and Grant Permissions in MySQL MySQL MySQL, the most popular Open Source [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[179],"class_list":["post-3469","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-mysql-2","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-TX","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=3469"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3469\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}