{"id":1685,"date":"2015-01-27T22:02:14","date_gmt":"2015-01-27T22:02:14","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=1685"},"modified":"2015-01-27T22:02:14","modified_gmt":"2015-01-27T22:02:14","slug":"add-mysql-user-grant-permissions-database","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2015\/01\/27\/add-mysql-user-grant-permissions-database\/","title":{"rendered":"How to Create a MySQL User: Remove a MySQL User, Show a MySQL User"},"content":{"rendered":"\n<p>This article shows how to create a MySQL user, remove a MySQL user and to show a list of MySQL users.<\/p>\n\n\n<a class=\"wp-block-read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2015\/01\/27\/add-mysql-user-grant-permissions-database\/\" target=\"_self\">Read more<span class=\"screen-reader-text\">: How to Create a MySQL User: Remove a MySQL User, Show a MySQL User<\/span><\/a>\n\n<p>Grant all privileges on a database to a single user:<br>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&lt;\/p&gt;\n&lt;p&gt;mysql&amp;gt; CREATE USER &#039;new_user&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;new_password&#039;;&lt;\/p&gt;\n&lt;p&gt;<\/pre><\/p>\n<p><pre class=\"brush: bash; title: ; notranslate\" title=\"\">&lt;br&gt;\nmysql&amp;gt; GRANT ALL ON my_db.* TO &#039;new_user&#039;@&#039;localhost&#039;;&lt;br&gt;\n<\/pre><\/p>\n<p>Or&#8230;<\/p>\n<p><pre class=\"brush: bash; title: ; notranslate\" title=\"\">&lt;br&gt;\nmysql&amp;gt; GRANT ALL PRIVILEGES ON database_name.* to &#039;new_user&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;password&#039;;&lt;br&gt;\n<\/pre><\/p>\n<p>Remove a USer from Mysql<\/p>\n<p>Review a List of MySQL Users<br>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&lt;\/p&gt;\n&lt;p&gt;mysql&amp;gt; SELECT User,Host FROM mysql.user;&lt;\/p&gt;\n&lt;p&gt;<\/pre><\/p>\n<p>Remove a MySQL User<br>\nTo remove a user from MySQL, we again use the DROP command.<\/p>\n<p>It only takes one simple command to delete a user in MySQL, but BEWARE; dropping a user can not be undone! The command is as follows:<br>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&lt;\/p&gt;\n&lt;p&gt;mysql&amp;gt; DROP USER &#039;testuser&#039;@&#039;localhost&#039;;&lt;\/p&gt;\n&lt;p&gt;<\/pre><\/p>\n<p>If a user of the name testuser does not exist, then you\u2019ll receive this error:<br>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&lt;\/p&gt;\n&lt;p&gt;mysql&amp;gt; ERROR 1396 (HY000): Operation DROP USER failed for &#039;testuser&#039;@&#039;localhost&#039;&lt;\/p&gt;\n&lt;p&gt;<\/pre><\/p>","protected":false},"excerpt":{"rendered":"<p>This article shows how to create a MySQL user, remove a MySQL user and to show a list of MySQL users. Grant all privileges on a database to a single user: &lt;\/p&gt; &lt;p&gt;mysql&amp;gt; CREATE USER &#039;new_user&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;new_password&#039;;&lt;\/p&gt; &lt;p&gt; &lt;br&gt; mysql&amp;gt; GRANT ALL ON my_db.* TO &#039;new_user&#039;@&#039;localhost&#039;;&lt;br&gt; Or&#8230; &lt;br&gt; mysql&amp;gt; GRANT ALL PRIVILEGES ON &#8230; <a title=\"How to Create a MySQL User: Remove a MySQL User, Show a MySQL User\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2015\/01\/27\/add-mysql-user-grant-permissions-database\/\" aria-label=\"Read more about How to Create a MySQL User: Remove a MySQL User, Show a MySQL User\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70],"tags":[],"class_list":["post-1685","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=1685"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1685\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=1685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=1685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=1685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}