The next few articles are aimed at showing the basics terminal commands for controlling and investigating MySQL.
This article starts at the beginning (always a good start point) and explains how to list the MySQL databases.
First thing is to log into your Slice via the terminal or PuTTY, etc and then log into MySQL:
mysql -u root -p
You will be prompted for your MySQL root password (note this is not the same as the Slice root password).
Do note that all MySQL commands must end in a semi-colon (;) so that it knows that is the end of the command and to execute it.
We want to show the databases and the command is simply:
The command does not have to be in capitals - I use capitals for clarity.
On my test Slice running Ubuntu Hardy the output is as follows:
mysql> SHOW databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | +--------------------+ 2 rows in set (0.00 sec)
As you can see, the default installation on Ubuntu Hardy has two databases: information_schema and mysql.
Both are required for the base running of MySQL and should not be adjusted by hand.
If you are using a different distribution you may see a third database called 'test'.
This should be deleted as soon as possible and the next article deals with creating and deleting databases.
MySQL is actually very easy to control via the command line and, once used to the commands, can save the overhead of running something like PHPMyAdmin to administer.