> 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)

Oracle MySQL.

<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)
