mysql

Commands

# Import database from file
mysql -u [DB_USER] -p [DB_NAME] < data.sql

# Export database to file
mysqldump -u [DB_USER] -p [DB_NAME] > data.sql

# Enter "mysql" prompt
mysql -u [DB_USER] -p

# Run queries
create database learningLaravel;
show databases;

# Exit "mysql" prompt
CONTROL + C

Useful queries

Check table sizes

SELECT table_schema "DB Name", ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;

Note: deleting tables using InnoDB engine does not free up that disk space. Check /var/lib/mysql. You have to fully uninstall and reinstall MySQL. Reference

For MAMP

See: Workspace > Mac Apps > MAMP

For Media Temple Grid

# Enter "mysql" prompt
mysql -h internal-db.s00000.gridserver.com -u [DB_USER]