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

SQL · Theory

Account Unlock

← All stacks

Theory

29/439

Account Unlock

ALTER USER 'asha'@'localhost' ACCOUNT UNLOCK; allows login again after a lock or after password policy lockout (depending on version/settings).

If login still fails, the password or host ('asha'@'%') may be wrong — unlock is not a password reset.

Trap — UNLOCK and assuming the password is the one you remember from last year.

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

Exam tip

ALTER USER 'asha'@'localhost' ACCOUNT UNLOCK;

Account Unlock — sample query

-- Account Unlock
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;

Account Unlock: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Short notes

  • DefACCOUNT UNLOCK re-enables a locked user.
  • RuleStill need the correct password and host.
  • TrapUnlock ≠ reset password.

Questions

1

Unlock vs password reset?

29 / 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.