Connection
Common command to connect MariaDB and MySQL databases (avoid -p if you want to be prompted for the password):
1
mysql -h 10.129.5.43 -u root -p 'th1s!smypassw0rd'
MySQL Basic Commands:
show databases; --Show all databases.
use <database>; --Select one of the existing databases.
show tables; --Show all available tables in the selected database.
show columns from <table>; --Show all columns in the selected database.
select * from <table>; --Show everything in the desired table.
select * from <table> where <column> = "<string>"; --Search for needed string in the desired table.
MariaDB [(none)]> show variables; --Show all environment variables
+------------------------------------------+--------------------------------------+
| Variable_name | Value |
+------------------------------------------+--------------------------------------+
| alter_algorithm | DEFAULT |
| aria_block_size | 8192 |
| aria_checkpoint_interval | 30 |
...
| hostname | zora |
| identity | 0 |
...
| pid_file | /run/mysqld/mariadb.pid |
| plugin_dir | /home/dev/plugin/ |
| plugin_maturity | gamma |
| port | 3306 |
| preload_buffer_size | 32768 |
| profiling | OFF |
...
| tmp_memory_table_size | 16777216 |
| tmp_table_size | 16777216 |
| tmpdir | /var/tmp |
| transaction_alloc_block_size | 8192 |
...
| userstat | OFF |
| version | 10.3.20-MariaDB |
| version_comment | MariaDB Server |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
| version_malloc_library | system |
...
| wsrep_sst_receive_address | AUTO |
| wsrep_start_position | 00000000-0000-0000-0000-000000000000:|
| wsrep_sync_wait | 0 |
+------------------------------------------+--------------------------------------+
639 rows in set (0.154 sec)
show grants; --Show user's permissions
select version(); --Show MySQL version
MYSQLSHOW
Extract databases:
1
mysqlshow
DUMPING DATABASE
Dump content from a database:
1
mysqldump ETSCTF
Examples: ECHO CTF PCPrincipal