{"id":1678,"date":"2017-02-13T07:14:42","date_gmt":"2017-02-13T07:14:42","guid":{"rendered":"http:\/\/www.fastwebhost.in\/blog\/?p=1678"},"modified":"2021-04-22T06:04:43","modified_gmt":"2021-04-22T06:04:43","slug":"mysql-list-users-how-to-list-mysql-user-accounts-via-command-line","status":"publish","type":"post","link":"https:\/\/www.fastwebhost.in\/blog\/mysql-list-users-how-to-list-mysql-user-accounts-via-command-line\/","title":{"rendered":"MySQL List Users \u2013 How to List MySQL User Accounts via command line?"},"content":{"rendered":"<p>You are using the MySQL Database server and created database and users. Now you need to see MySQL users list. How can you view users? &nbsp;In this tutorial, you will see how to list MySQL user accounts via command line.<\/p>\n<h2>Login to MySQL Server<\/h2>\n<p>Once you are in Linux \/ Ubuntu command line enter below command to access MySQL server.<\/p>\n<p><span style=\"font-size: 15px;\">shell&gt; &nbsp;mysql &#8211;user=root mysql<\/span><\/p>\n<p>The above command connects you to MySQL server interface with root user. If you have assigned a password to the root account, you must also supply a &#8211;password or -p option.<\/p>\n<p><span style=\"font-size: 15px;\">shell&gt; mysql &#8211;user=root mysql -p<\/span><\/p>\n<p>After connecting to MySQL server successfully, you can list users.<\/p>\n<h2>List&nbsp;MySQL Users<\/h2>\n<p>Use below SQL query to see list of mysql users.<\/p>\n<p><span>mysql&gt; &nbsp;SELECT User FROM mysql.user;<\/span><\/p>\n<p>The above command trims of &#8220;<span>User<\/span>&#8221; table and lists only user names.<\/p>\n<p>+&#8212;&#8212;-+| User  |+&#8212;&#8212;-+| root  |+&#8212;&#8212;-+| newuser |+&#8212;&#8212;-+<\/p>\n<p>If you want to list of MySQL user information, including user permission information and all users data. You could try below query.<\/p>\n<p><span>mysql&gt; select * from mysql.user;<\/span><span>.<\/span><\/p>\n<p>You could try other variations with below example queries.<\/p>\n<p><span>mysql&gt; select User, Host from mysql.user;<\/span><span>mysql&gt; select User, Host, Password from mysql.user;<\/span><span>mysql&gt; <\/span><span>select DISTINCT User FROM mys<\/span><span>ql.user;<\/span><\/p>\n<h2>MySQL Users Information<\/h2>\n<p>You can see all the fields in the <span>mysql.user <\/span>table including description by running this MySQL query.<\/p>\n<p>mysql&gt; desc mysql.user;<\/p>\n<p>If you have any additional questions on how to show all users in MySQL, feel free to ask us through below comment box.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You are using the MySQL Database server and created database and users. Now you need to see MySQL users list. How can you view users? &nbsp;In this tutorial, you will see how to list MySQL user accounts via command line. Login to MySQL Server Once you are in Linux \/ Ubuntu command line enter below [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1695,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[22,74],"tags":[36],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/posts\/1678"}],"collection":[{"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/comments?post=1678"}],"version-history":[{"count":3,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/posts\/1678\/revisions"}],"predecessor-version":[{"id":5175,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/posts\/1678\/revisions\/5175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/media\/1695"}],"wp:attachment":[{"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/media?parent=1678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/categories?post=1678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/tags?post=1678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}