Thursday, May 8, 2008

See list of MySQL databases via GNU Linux shell command line

Key words and phrases:
mysql list databases command line check if database exists
Description & Info:

Dirty secret is this will work with Windows or anything else that runs MySQL, as well as the recommended Debian, Ubuntu, Red Hat / RHEL (which is what CentOS really is) etc.

mysql -u root -p

(The long form, which is quite unnecessary, is " mysql --user=user-name --password=your-password")

Once in the MySQL command line utility:

SHOW DATABASES;

Then to see what's in a particular database:

USE agaric_example
SHOW TABLES;

No comments: