Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I run a MySQL server and I have MySQL root-level privileges on this instance:

mysql> select CURRENT_USER();
| root@localhost |
1 row in set (0.02 sec)

I am troubleshooting MySQL privileges for a series of users. I do not know the passwords for these users. As the MySQL root user, can I assume the identity of another user without knowing their password?

In the Linux/Unix world, I would do this with a command like 'su - someuser' to assume the identity of the user. Does MySQL provide an equivalent function?

share|improve this question
Great question. I've never heard of such a thing, but will be quite interested to see if indeed there is. – EEAA Mar 17 '14 at 19:02
Oh, and BTW...sysadmin/parent here as well. :) – EEAA Mar 17 '14 at 19:03
The only way I know of doing something like this would be to safely store the user's password hash then set a new password and when you're finished put the hash back as it was. Obviously, the user gets locked out while you do this. – Iain Mar 17 '14 at 19:07
Thanks Iain. That's what I normally do, but I was hoping for something quicker. su - jane on Unix is a super quick and simple solution and I am hoping to find something like this on MySQL. – Stefan Lasiewski Mar 17 '14 at 19:13
@StefanLasiewski: I don't think that exists you could always clone the privs to another account… – Iain Mar 17 '14 at 19:18

What you are asking for can only be done in two ways


MySQL 5.5 introduced proxy users

When authentication to the MySQL server occurs by means of an authentication plugin, the plugin may request that the connecting (external) user be treated as a different user for privilege-checking purposes. This enables the external user to be a proxy for the second user; that is, to have the privileges of the second user. In other words, the external user is a “proxy user” (a user who can impersonate or become known as another user) and the second user is a “proxied user” (a user whose identity can be taken on by a proxy user).

You can find the defined proxy users in mysql.proxies_priv:

mysql> desc mysql.proxies_priv;
| Field        | Type       | Null | Key | Default           | Extra                       |
| Host         | char(60)   | NO   | PRI |                   |                             |
| User         | char(16)   | NO   | PRI |                   |                             |
| Proxied_host | char(60)   | NO   | PRI |                   |                             |
| Proxied_user | char(16)   | NO   | PRI |                   |                             |
| With_grant   | tinyint(1) | NO   |     | 0                 |                             |
| Grantor      | char(77)   | NO   | MUL |                   |                             |
| Timestamp    | timestamp  | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
7 rows in set (0.22 sec)


Here is sample code from the MySQL Documentation

CREATE USER 'empl_external'@'localhost'
  IDENTIFIED WITH auth_plugin AS 'auth_string';
CREATE USER 'employee'@'localhost'
  IDENTIFIED BY 'employee_pass';
  ON 'employee'@'localhost'
  TO 'empl_external'@'localhost';


In mysql.proc, there is a column called security_type. With views, this exists in information_schema.views. It has two values 1) invoker and 2) definer. If a stored procedure has security_type as definer, you have the same access rights as the owner of the stored procedure. Of course, this is only applicable

  • when calling a Stored Procedure or SELECTing from a View
  • You have the EXECUTE privilege
share|improve this answer
Thanks again Rolando. This looks like a good solution when a long term solution is needed (And I could use this elsewhere). For my one-off tests, I will probably chose a simpler solution like copying the privileges to a temporary user with a password that I do know. – Stefan Lasiewski Mar 17 '14 at 23:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.