Skip to content
Menu
DevSecOps Now!!!
  • About
  • Certifications
  • Contact
  • Courses
  • DevSecOps Consulting
  • DevSecOps Tools
  • Training
  • Tutorials
DevSecOps Now!!!

How to Make Yourself an Admin in WordPress (via Database Access)

Posted on October 15, 2025

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Applicable when you have:

  • ๐Ÿ–ฅ๏ธ Server or cPanel access
  • ๐Ÿ—„๏ธ Database access (phpMyAdmin or MySQL CLI)
  • โŒ No access to the WordPress Dashboard

Identify the Database in Use

Before anything, confirm which database your WordPress site is using.

  1. Go to your WordPress installation folder.
  2. Open the file: wp-config.php
  3. Look for these lines: define('DB_NAME', 'your_database_name'); define('DB_USER', 'your_db_user'); define('DB_PASSWORD', 'your_db_password'); define('DB_HOST', 'localhost'); $table_prefix = 'wp_';
  4. Note down the database name and table prefix (e.g., wp_, wz_, etc.).

Open phpMyAdmin

  1. Log into your server control panel (e.g., cPanel, XAMPP, or direct phpMyAdmin).
  2. Select your WordPress database from the left sidebar.
  3. Youโ€™ll see tables like: wp_users wp_usermeta wp_posts ... (Your prefix may differ, e.g., wz_users)

Check Existing Admin Users

You can easily see which users already have admin rights.

Option A: Manual (through phpMyAdmin)

  1. Open the wp_usermeta table.
  2. In the Search tab, find meta_key and enter: %capabilities%
  3. Check rows where meta_value contains: a:1:{s:13:"administrator";b:1;} The corresponding user_id is an admin.
  4. Go back to wp_users โ†’ find the same ID to see which username is the admin.

Option B: Using SQL Query

Run this SQL query directly:

SELECT u.ID, u.user_login, u.user_email, m.meta_value
FROM wp_users u
JOIN wp_usermeta m ON u.ID = m.user_id
WHERE m.meta_key = 'wp_capabilities'
AND m.meta_value LIKE '%administrator%';

This will list all admin accounts instantly.


Make Yourself an Admin (If Youโ€™re Not One Yet)

If you found your user in wp_users but not as an admin, you can assign admin privileges manually.

Step 1: Find your user_id

From wp_users, locate your username โ€” for example:

IDuser_loginuser_email
19rajeshkumarrajesh@devopsschool.com

So here, your user_id = 19.


Step 2: Insert Admin Capabilities

Run these SQL statements (replace wp_ with your actual prefix, and 19 with your user ID):

INSERT INTO wp_usermeta (user_id, meta_key, meta_value)
VALUES (19, 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');

INSERT INTO wp_usermeta (user_id, meta_key, meta_value)
VALUES (19, 'wp_user_level', '10');

Thatโ€™s it โ€” your account now has full administrator privileges.


Log in to WordPress Dashboard

  1. Go to your site admin page: https://yourdomain.com/wp-admin
  2. Log in with your existing credentials (same username and password from wp_users).
  3. Youโ€™ll now have complete access as an administrator.

Alternative Method (If phpMyAdmin Isnโ€™t Available)

If you have file access but no database access, you can still make yourself admin through your theme.

Steps:

  1. Open your serverโ€™s file manager or FTP.
  2. Go to your active theme directory: /wp-content/themes/your-active-theme/
  3. Edit the file functions.php and add this code at the very end: function make_me_admin(){ $user = 'rajesh'; $pass = 'YourSecurePassword'; $email = 'rajesh@example.com'; if ( !username_exists( $user ) ) { $user_id = wp_create_user( $user, $pass, $email ); $user = new WP_User( $user_id ); $user->set_role( 'administrator' ); } } add_action( 'init', 'make_me_admin' );
  4. Save the file, then reload your site once in the browser.
    • WordPress will auto-create an admin user with those credentials.
  5. After logging in successfully, remove that code from functions.php immediately.

Optional: Reset Your Password via SQL

If you forgot your admin password, you can reset it directly in the database.

Run this command (replace with your username):

UPDATE wp_users SET user_pass = MD5('NewSecurePassword') WHERE user_login = 'rajesh';

Troubleshooting Tips

ProblemLikely CauseFix
You canโ€™t log in even after inserting SQLWrong table prefixDouble-check prefix in wp-config.php
Login shows โ€œIncorrect passwordโ€MD5 missing or wrongEnsure password uses MD5() in SQL
โ€œSorry, you are not allowed to access this page.โ€User not mapped correctlyRe-run both INSERT INTO wp_usermeta statements
You donโ€™t know table namesCheck SHOW TABLES; in SQL or phpMyAdmin sidebar
You get duplicate key errorAlready have wp_capabilities entryUse UPDATE instead of INSERT

Summary

TaskSQL / Step
Find AdminsSELECT ... LIKE '%administrator%'
Make User Admin2x INSERT INTO wp_usermeta
Reset PasswordUPDATE wp_users SET user_pass = MD5('password')
Create Admin via CodeAdd snippet to functions.php

Recommended Best Practices

  • Always backup your database before making edits.
  • Remove any temporary PHP code after it runs.
  • Limit phpMyAdmin access to trusted IPs only.
  • Use strong passwords for all admin accounts.
  • Once restored, review the Users โ†’ All Users page in WordPress and clean up unwanted admin entries.

Post Views: 649
  • WordPress
  • WordPress troubleshooting
Subscribe
Login
Notify of
guest
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
  • The Complete DevOps Salary Overview for IT Professionals
  • The Modern DevOps Certification Guide: Roadmaps for Every Engineering Role
  • Security Champions in DevSecOps: Responsibilities and Best Practices
  • The DevSecOps Handbook for Shift-Left Security
  • Top DevSecOps Principles for Effective Secure Software Delivery
  • Guide to DevSecOps Maturity Levels for Platform and Security Teams
  • Canada PR CRS Calculator: Express Entry Points System Explained
  • Austria PR Points Calculator: Ultimate Guide to Navigating the Red-White-Red Card System
  • The Essential Guide to Enterprise DevSecOps Implementation
  • How to Set Up Claude Code Agent on a Local Windows Laptop and Use claude Command from Anywhere
  • DevOps and DevSecOps Explained: Bridging the Gap Between Speed and Security
  • Comprehensive Manual on DevOps Methodologies and Cloud Native Engineering
  • The Master Guide to Immigration Points: Calculating Your Path to Canada, Australia, and Beyond
  • How to Skip the Activation Email and Password Reset After Google Login in Keycloak Auto-Link Existing Users in First Broker Login
  • Free SSL Certificate Generation Tutorial for Any Website Using Certbot and Apache
  • The Ultimate Guide to Certified FinOps Professional: Skills, Levels, and Career Impact
  • Certified FinOps Manager: Essential Skills for Modern Cloud Operations
  • How to Use Claude AI for Programming: Complete Guide for Developers to Boost Productivity
  • The Definitive Guide to Certified FinOps Engineer: Master Cloud Value Engineering
  • A Comprehensive Guide to the Certified FinOps Architect Certification and Training
  • Linux Server Diagnostic Commands: Complete Guide for Performance, Network & System Troubleshooting
  • The Ultimate Guide to CDOM โ€“ Certified DataOps Manager Certification
  • The Practical Path to AI Reliability: A Guide to the Certified MLOps Manager
  • Master the Machine Learning Lifecycle:Guide to Becoming a Certified MLOps Architect
  • How to Build a Project-Level AI Memory System That Works Across Codex, Claude, and Other AI Coding Tools
  • Certified MLOps Professional: A Deep Dive into the Certified MLOps Professional Certification
  • Certified MLOps Engineer : The Comprehensive Guide to Mastering Machine Learning Operations
  • Codex vs Claude: A Complete Practical Guide for Modern Developers (2026)
  • Certified AIOps Professional Program A Guide to Career Growth
  • Keycloak Multi-Client Architecture with Project-Based Email Validation (Student, Trainer, Company, Consulting)

Recent Comments

  1. emmy day on SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘provider’ in ‘field list’
  2. digital banking on Complete Tutorial: Setting Up Laravel Telescope Correctly (Windows + XAMPP + Custom Domain)
  3. SAHIL DHINGRA on How to Uninstall Xampp from your machine when it is not visible in Control panel programs & Feature ?
  4. Abhishek on MySQL: List of Comprehensive List of approach to secure MySQL servers.
  5. Kristina on Best practices to followed in .httacess to avoid DDOS attack?

Archives

  • May 2026
  • April 2026
  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022

Categories

  • Ai
  • AI Blogging
  • AiOps
  • ajax
  • Android Studio
  • Antimalware
  • Antivirus
  • Apache
  • Api
  • API Security
  • Api Testing
  • APK
  • Aws
  • Bike Rental Services
  • ChatGPT
  • Code Linting
  • Composer
  • cPanel
  • Cyber Threat Intelligence
  • Cybersecurity
  • Data Loss Prevention
  • Database
  • dataops
  • Deception Technology
  • DeepSeek
  • Devops
  • DevSecOps
  • DevTools
  • Digital Asset Management
  • Digital Certificates
  • Docker
  • Drupal
  • emulator
  • Encryption Tools
  • Endpoint Security Tools
  • Error
  • facebook
  • Firewalls
  • Flutter
  • git
  • GITHUB
  • Google Antigravity
  • Google play console
  • Google reCAPTCHA
  • Gradle
  • Guest posting
  • health and fitness
  • IDE
  • Identity and Access Management
  • Incident Response
  • Instagram
  • Intrusion Detection and Prevention Systems
  • jobs
  • Joomla
  • Keycloak
  • Laravel
  • Law News
  • Lawyer Discussion
  • Legal Advice
  • Linkedin
  • Linkedin Api
  • Linux
  • Livewire
  • Mautic
  • Medical Tourism
  • MlOps
  • MobaXterm
  • Mobile Device Management
  • Multi-Factor Authentication
  • MySql
  • Network Traffic Analysis tools
  • Paytm
  • Penetration Testing
  • php
  • PHPMyAdmin
  • Pinterest Api
  • Quora
  • SAST
  • SecOps
  • Secure File Transfer Protocol
  • Security Analytics Tools
  • Security Auditing Tools
  • Security Information and Event Management
  • Seo
  • Server Management Tools
  • Single Sign-On
  • Site Reliability Engineering
  • soft 404
  • software
  • SSL
  • SuiteCRM
  • SysOps
  • Threat Model
  • Twitter
  • Twitter Api
  • ubuntu
  • Uncategorized
  • Virtual Host
  • Virtual Private Networks
  • VPNs
  • Vulnerability Assessment Tools
  • Web Application Firewalls
  • Windows Processor
  • Wordpress
  • WSL (Windows Subsystem for Linux)
  • X.com
  • Xampp
  • Youtube
©2026 DevSecOps Now!!! | WordPress Theme: EcoCoded
wpDiscuz