> For the complete documentation index, see [llms.txt](https://ivalexev.gitbook.io/rednote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ivalexev.gitbook.io/rednote/utility/service/mysql-3306.md).

# MySQL (3306)

<details>

<summary>Protocol Information</summary>

MySQL is an open source **relational database** management system based on SQL (Structured Query Language) developed and supported by Oracle.

MariaDB, which is often associated with MySQL, is a fork of the original MySQL code. This is because the lead developer of MySQL left the MySQL AB company after it was acquired by Oracle and developed another open source SQL database management system based on the MySQL source code, calling it MariaDB.

</details>

## Port

<table data-header-hidden><thead><tr><th width="166">Port</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:green;"><strong>3306</strong></mark><strong> TCP</strong></td><td>MySQL</td></tr></tbody></table>

## Config File

* `/etc/mysql/mysql.conf.d/mysqld.cnf`

## Interact

You can check if it is possible to log in with user `“root”` and password `“”`.

{% code overflow="wrap" %}

```bash
mysql -h <IP> -P <PORT> -u <USER> -p [--skip-ssl-verify-server-cert]
```

{% endcode %}

If `ERROR 2026 (HY000) TLS/SSL` error shows up, we can append `--skip-ssl` at the end of the command to connect to the database.

{% code overflow="wrap" %}

```powershell
C:\xampp\mysql\bin> .\mysql.exe -u <USER> -p <PASS> -D <DB_NAME> -e "SHOW TABLES;"
```

{% endcode %}

Or [Connect with dbeaver](https://www.youtube.com/watch?v=PeuWmz8S6G8\&ab_channel=JulioUre%C3%B1a%28plaintext%29).

```
> show databases;
> use <DBNAME>;
> show tables;
> describe <TABLE>;
> select * from <TABLE>;
> show grants;
> select load_file(”/etc/shadow”);    # with root access
```

[DEFINITION](https://dev.mysql.com/doc/refman/5.7/en/sql-data-definition-statements.html), [MANIPULATION](https://dev.mysql.com/doc/refman/5.7/en/sql-data-manipulation-statements.html), [DATATYPE](https://dev.mysql.com/doc/refman/8.0/en/data-types.html)

## Attacks

* [SQLi and more with MySQL](/rednote/pentesting-process/web-attacks/sqli.md#mysql)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://ivalexev.gitbook.io/rednote/utility/service/mysql-3306.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
