1. Outputting a table as a CSV file
    mysql -u username -p dbname -B -e "select * from tablename;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > outputfile.csv
    E.G: mysql -u securityAudit -p securityAudit -B -e "select * from auditReports;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > alldata.csv
  2. Signin to a database: mysql -u username -p databaseName
    E.G. mysql -u securityAudit -p securityAudit
  3. Display all tables in a database: show tables;
  4. Display all columns in a table: SHOW COLUMNS FROM tableName;
  5. Run an sql script from command prompt: mysql -u root -p --database=census < myscript.sql