Find mysql commands history without mysql server login


This is a small tip to find mysql commands history without login into mysql server.When we login into MySQL server,generally we uses up and down arrow key to find the history of MySQL commands.
Actually the MySQL commands history are saved in file called .mysql_history located in userís home directory by which he/she logged into Linux System.

For eg. I login into MySQL server after using my system username called linuxworld and after this I log into mysql server,the MySQL history file will be saved in userís home directory that is linuxworld home directory.
If you log into system with any particular user and then login into mysql server ,only mysql history will be saved in .mysql_history located in this particular userís home directory.

[email protected]:~$ ls -l .mysql_history
-rw——- 1 linux linux 2448 Nov 15 20:57 .mysql_history
[email protected]:~$ ls -l ~/.mysql_history
-rw——- 1 linux linux 2448 Nov 15 20:57 /home/linux/.mysql_history
[email protected]:~$
[email protected]:~$ tail ~/.mysql_history
select time();
select date();
use owncloud
show databases;
create database owncloud;
use owncloud
show tables;
select * from oc_queuedtasks;
[email protected]:~$