How to get a list of user accounts using the command line in MySQL?

前端 未结 15 1910
自闭症患者
自闭症患者 2020-12-22 14:35

I\'m using the MySQL command line utility and can navigate through a database. Now I need to see a list of user accounts. How can I do this?

I\'m using MySQL version

15条回答
  •  独厮守ぢ
    2020-12-22 14:55

    $>  mysql -u root -p -e 'Select user from mysql.user' > allUsersOnDatabase.txt
    

    Executing this command on linux prompt will first ask for the password of mysql root user, on providing correct password it will print all the database users to the text file.

提交回复
热议问题