Executing a query quickly from the console is nice to be able to do (without having to enter the MySQL console).
- This will simply output the result to the console where you are.
user@server:~$ mysql -uUSERNAME -p TABLENAME --execute "REPAIR TABLE position";
Replace USERNAME and TABLENAME with your vars
- If you would like the output to a file
mysql -uUSERNAME -p TABLENAME --execute "SELECT * FROM test" > test.sql;
Replace USERNAME and TABLENAME with your vars
- If you would like the output to be sent as a email
mysql -uUSERNAME -p TABLENAME --execute "SELECT * FROM test" | mail -s 'SUBJECT' example@mail.com
Replace USERNAME, TABLENAME, SUBJECT and example@mail.com with your vars