{"id":4037,"date":"2020-02-12T13:27:41","date_gmt":"2020-02-12T06:27:41","guid":{"rendered":"https:\/\/tino.vn\/?post_type=ht_kb&#038;p=4037"},"modified":"2020-03-06T16:17:12","modified_gmt":"2020-03-06T09:17:12","slug":"quan-ly-user-tren-mariadb","status":"publish","type":"ht_kb","link":"https:\/\/tino.vn\/blog\/docs\/quan-ly-user-tren-mariadb\/","title":{"rendered":"Qu\u1ea3n l\u00fd user tr\u00ean MariaDB"},"content":{"rendered":"<p><iframe loading=\"lazy\" src=\"\/\/www.youtube.com\/embed\/Wz3DOCV-g6M\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>C\u00e1c l\u1ec7nh c\u01a1 b\u1ea3n \u0111\u1ec3 qu\u1ea3n l\u00fd user Mariadb<\/p>\n<p>Hi\u1ec3n th\u1ecb to\u00e0n b\u1ed9 users:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; SELECT * FROM mysql.user;\r\n<\/pre>\n<p>X\u00f3a null user:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; DELETE FROM mysql.user WHERE user = ' ';\r\n<\/pre>\n<p>X\u00f3a t\u1ea5t c\u1ea3 user m\u00e0 kh\u00f4ng ph\u1ea3i root:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; DELETE FROM mysql.user WHERE NOT (host=\"localhost\" AND user=\"root\");\r\n<\/pre>\n<p>\u0110\u1ed5i t\u00ean t\u00e0i kho\u1ea3n root :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; UPDATE mysql.user SET user=\"toor\" WHERE user=\"root\";\r\n<\/pre>\n<p>G\u00e1n full quy\u1ec1n cho m\u1ed9t user m\u1edbi:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'mypass' WITH GRANT OPTION;\r\n<\/pre>\n<p>Ph\u00e2n quy\u1ec1n chi ti\u1ebft cho m\u1ed9t user m\u1edbi:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON mydatabase.* TO 'username'@'localhost' IDENTIFIED BY 'mypass';\r\n<\/pre>\n<p>G\u00e1n full quy\u1ec1n cho m\u1ed9t user m\u1edbi tr\u00ean m\u1ed9t database nh\u1ea5t \u0111\u1ecbnh:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; GRANT ALL PRIVILEGES ON mydatabase.* TO 'username'@'localhost' IDENTIFIED BY 'mypass' WITH GRANT OPTION;\r\n<\/pre>\n<p>Thay \u0111\u1ed5i m\u1eadt kh\u1ea9u user:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; UPDATE mysql.user SET password=PASSWORD(\"newpass\") WHERE User='username';\r\n<\/pre>\n<p>X\u00f3a user:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; DELETE FROM mysql.user WHERE user=\"username\";\r\n<\/pre>\n<p>reload user:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mysql&gt; FLUSH PRIVILEGES;\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\u00e1c l\u1ec7nh c\u01a1 b\u1ea3n \u0111\u1ec3 qu\u1ea3n l\u00fd user Mariadb Hi\u1ec3n th\u1ecb to\u00e0n b\u1ed9 users: mysql&gt; SELECT * FROM mysql.user; X\u00f3a null user: mysql&gt; DELETE FROM mysql.user WHERE user = &#8216; &#8216;; X\u00f3a t\u1ea5t c\u1ea3 user m\u00e0 kh\u00f4ng ph\u1ea3i root: mysql&gt; DELETE FROM mysql.user WHERE NOT (host=&#8221;localhost&#8221; AND user=&#8221;root&#8221;); \u0110\u1ed5i t\u00ean t\u00e0i kho\u1ea3n root : mysql&gt; [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":16424,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"tags":[],"ht_kb_category":[5156],"class_list":["post-4037","ht_kb","type-ht_kb","status-publish","format-standard","has-post-thumbnail","hentry","ht_kb_category-mariadb"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb\/4037","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=4037"}],"version-history":[{"count":0,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb\/4037\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/16424"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=4037"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=4037"},{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb_category?post=4037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}