PGoCareerGoCareer prep tools
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

SQL · Theory

Login with Different User

← All stacks

Theory

333/439

Login with Different User

Login with Different User is about MySQL accounts, not table rows. Users are 'name'@'host'. CREATE USER, GRANT, ALTER USER … IDENTIFIED BY, DROP USER.

SHOW GRANTS FOR CURRENT_USER; to see yourself. Don’t use root from the app. Lock/unlock is ACCOUNT LOCK.

Trap — user@localhost vs user@% as two different accounts.

On the example next to this theory: Login with Different User: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Exam tip

'user'@'host', GRANT, not root from the app.

Login with Different User — sample query

-- Login with Different User
CREATE TABLE demo (
  id INTEGER PRIMARY KEY,
  label TEXT NOT NULL,
  qty INTEGER DEFAULT 0
);
INSERT INTO demo (id, label, qty) VALUES
  (1, 'alpha', 2),
  (2, 'beta', 5);
SELECT label, qty FROM demo WHERE qty >= 2 ORDER BY qty DESC;

Login with Different User: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Short notes

  • DefMySQL user = 'user'@'host' + password + grants.
  • RuleLeast privilege. App is not root.
  • Traplocalhost vs % accounts.

Questions

1

What is 'asha'@'localhost'?

333 / 439

P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.