Defindit Docs and Howto Home

This page last modified: Jun 04 2007
title:MySQL notes
description:Hints and notes for getting started with MySQL
keywords:mysql,table,create,database,


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
mysql:


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

mysql -h dbserv.data.example.com  -u db_user db_name -p


show tables;

show columns from table annot;

http://dev.mysql.com/doc/mysql/en/SHOW.html

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.)