# 3306/TCP (MySQL)

## Banner grabbing <a href="#banner-grabbing" id="banner-grabbing"></a>

```sh
nc -vn <target> 3306
```

## Vulnerabilidades <a href="#vulnerabilidades" id="vulnerabilidades"></a>

### Nmap <a href="#nmap" id="nmap"></a>

```sh
nmap -p 3306 --script=vuln <target>
```

## Conexión

```shell
mysql -u <user> -h <target> -p
mysql --user=<user> --password=<password> --host=<target>
mysql --user=<user> --password=<password> --host=127.0.0.1 --port=<port>
mysql --user=<user> --password=<password> --host=<target> -e "<query>"
```

## Información general

```shell
# Versión
select version();

# Usuarios
select user();

# Bases de datos
show databases;

# Tablas
use <database>;
show tables;
describe <table>;
```

## Usuarios

```sql
SELECT user, host, authentication_string FROM mysql.user;
SELECT concat_ws(':', user, authentication_string) FROM mysql.user;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pentesting.mrw0l05zyn.cl/escaneo-y-enumeracion/servicios/3306-tcp-mysql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
