-1

DB Technology: MYSQL

Hello Everyone,

Someone knows how to switch to different user without exiting?

Many Thanks !!!

Nevdev
  • 31
  • 3
  • Duplicate: http://stackoverflow.com/questions/11394940/how-to-switch-between-users-in-mysql – RGO Dec 18 '13 at 11:50
  • Someone want to know what you have tried? – Code Lღver Dec 18 '13 at 11:50
  • mysql -u root -h localhost -p Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.5.8 MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> – Nevdev Dec 18 '13 at 11:53
  • Successfully logged in but from here I want to log into another user without exiting mysql and log in again. Is is possible? thanks – Nevdev Dec 18 '13 at 11:58

1 Answers1

0

You cannot do this. However, you can do something a little bit similar.

If you create a view or a stored procedure, you can use SQL SECURITY DEFINER to allow the person using the view or stored procedure to run statements within that object as if they are the "definer". You can then use the DEFINER=user@host syntax to specify who that definer is.

See http://dev.mysql.com/doc/refman/5.6/en/stored-programs-security.html for examples of how to do that.

Jeremy Smyth
  • 23,270
  • 2
  • 52
  • 65