Sunday, February 13, 2011

My Mac OS X MySQL Cheat Sheet

Using MySQL and Java? Check out an easier way: Yank

Following is my Mac OS X MySQL cheat sheet. Normally I use a great open source SQL client called Sequel Pro for my SQL work, but every now and then I need to log into MySQL directly using Terminal for some advanced options.

Log In

/usr/local/mysql/bin/mysql -u root -p

Create Database

create database DATABASE_NAME;

Show Databases

show databases;

Use Table

use TABLE_NAME;

Indexes

show index from TABLE_NAME;

Drop Table

drop table TABLE_NAME;

Truncate

truncate table TABLE_NAME;

See also: Uninstall MySQL on Mac OS X
And also: Install MySQL on Mac OS X
And also: Installing and Running Tomcat on Mac OS X
And also: Set MySQL Server System Variables on Mac OS X

No comments: