3306 - MySQL

MySQL is a very popular open-source relational database management system.

Connecting

Connect using one of the following options:

  1. mysql client (builtin in Kali)

  2. metasploit (mysql_login)

mysql client:

mysql -h 192.102.118.3 -u root

Basic Commands

show databases:

MySQL [(none)]> show databases; 
+--------------------+ 
| Database           | 
+--------------------+ 
| information_schema | 
| books              | 
| data               | 
| mysql              | 
| password           | 
| performance_schema | 
| secret             | 
| store              | 
| upload             | 
| vendors            | 
| videos             | 
+--------------------+ 
11 rows in set (0.001 sec) 
MySQL [(none)]>  

display tables:

load file:

Command execution

If mysql is running as root you can run commands by typing:

select sys_exec('whoami');

select sys_eval('whoami');

Enumeration

Nmap

Nmap scripts

User enumeration:

dump hashes

Metasploit

Modules:

Enumerate directories:

Last updated

Was this helpful?