Defindit Docs and Howto Home

This page last modified: Jun 04 2007
title:MySQL notes
description:Hints and notes for getting started with MySQL

By default, MySQL has the admin user "root". You can start the command
line mysql, but you'll discover that your options are limited. For
instance, you won't be able to create a new database.

Use this command:
mysql -u root -- password

You'll be prompted for the root password that you set using mysqladmin.

Here are some common command line arguments for the command line tool

-h host
-u userid
-p  (prompt for password)

mysql -h  -u db_user db_name -p

show tables;

show columns from table annot;

As far as I can tell, C-c will exit mysql, and there is no way to
cancel a command. Often you can just type some gibberish, and mysql
will give an error instead of running the command. (As opposed to the
PostgreSQL psql, which is a fully functional shell, complete with two
types of help, command line editing, history editing and the ability
to cancel commands.)