Updated: 24 May 2023
Run script on database, redirect output to log
mysql -u root -p db_name < sql_statement_file.sql >> query.log 2>&1
Check if remote mysqld requires secure connections
mysql --ssl-mode=DISABLED -h example.com -u root -p
Execute a statement directly
mysql -u root -p db_name -e "SELECT * FROM tbl_foo LIMIT 5"