Script #35
mysql
Securityread-only (mysql.user okuma yetkisi)Min Version: 5.7Risky MySQL User Accounts and Excess Privileges
Finds accounts with no password, open host access, or dangerous privileges like SUPER and FILE. A baseline check for security audits.
#users#privileges#hardening
mysql · sql
SELECT user, host, plugin,
(authentication_string = '') AS no_password,
account_locked, password_expired
FROM mysql.user
WHERE authentication_string = '' OR host = '%'
ORDER BY user;
SELECT grantee, privilege_type, is_grantable
FROM information_schema.user_privileges
WHERE privilege_type IN ('SUPER','FILE','SHUTDOWN','PROCESS')
ORDER BY grantee;Operational Notes & Remediation Guidance
Eliminate wildcard host accounts (`%`) for administrative users and revoke unnecessary global privileges.
Production Safety & Execution Standards
- This script is designed for read-only diagnostics; it does not alter schema or modify data directly.
- Prior to executing on production systems under high load, verify the target database version (Min. Version: 5.7).
- Exercise caution with mutating actions (e.g., terminating sessions or dropping indexes) referenced in the notes section.
Other MYSQL Diagnostic Scripts
View All (100)#21Performance
Find Long-Running Queries in MySQL
Lists active queries running longer than 60 seconds from the processlist. Fast diagnosis for slowdowns and lock pile-ups.
View Script
#22Locking
Find MySQL InnoDB Lock Waits and the Blocking Query
Uses the sys schema to show waiting and blocking sessions with lock modes. Resolves who is holding up whom in a single query.
View Script
#23Storage
List the Largest Tables and Disk Usage in MySQL
Ranks tables by data, index and free space size. Core input for capacity planning and archiving decisions.
View Script
#24Performance
Detect Unused Indexes in MySQL
Uses sys.schema_unused_indexes to list indexes that were never used. Helps safely drop indexes that slow down writes.
View Script