MySQL

MySQL Console Commands

Connect to MySQL Database

mysql -u root -p'root' -h 192.168.50.16 -P 3306

Find version of MySQL running:

select version();

Find user that the service is running as:

select system_user();

List databases on the system:

show databases;

Example MySQL query:

SELECT user, authentication_string FROM mysql.user WHERE user = 'dave';

Confirm MySQL

concat('a','b')
database()
version()
user()
system_user()
@@version
@@datadir
rand()
floor(2.9)
length(1)
count(1)

Useful Functions

All Injection Payload

Flow

Modern versions of MySQL can substitute "information_schema.tables" for "mysql.innodb_table_stats" which can be sueful to bypass WAFs.

Detect number of columns

Union Based MySQL Payload

MySQL Injection Without Commas

PayloadsAllTheThings Guide on MySQl Injection

Last updated