The SHOW GRANTS requires the SELECT privilege for the mysql database, except to see the privileges for the current user, so if you have such privilege you can also list the privileges granted to the other MySQL users. Without any additional parameters, the SHOW GRANTS command lists the privileges granted to the current user account with which you have connected to the server. If you want to see what users are set up in the MySQL user table, run the following command: SELECT User, Host FROM er +-+-+ User Host. Inside that database, the user information is in a table, a dataset, named user. In MySQL, you can use the SHOW GRANTS command to show privileges granted to a user. MySQL stores the user information in its own database. When a user tries to connect to the database, MySQL checks that that particular username/host/password combination has permission to connect. In MySQL 5.7 and higher: mysql> SELECT host,user,authentication_string FROM er Ĭool Tip: Need to change MySQL user password? This can be easily done from the command-line prompt! Read more → Show User Privileges In MySQL Any user that can connect to the database can be found in the user table. Show MySQL users, their passwords and hosts: mysql> SELECT user,host,password FROM er Show MySQL users and hosts they are allowed to connect from: mysql> SELECT user,host FROM er List only unique user names: mysql> SELECT DISTINCT user FROM er Show all MySQL users: mysql> SELECT user FROM er Important Notice: The % character does not include the localhost, as the localhost means a connection over a UNIX socket instead of a standard TCP/IP. In the Host field, besides of the common IP addresses and host names, you can see the % sign, that is a wildcard character that means “any” host. This allows the same user to use different MySQL accounts with different privileges, depending on which host they are connecting from. MySQL account consists of two components: user and host. In this article i will show how to list MySQL users, their passwords and granted privileges from the command-line prompt.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |