To talk to any database server, you will need to use a client of some kind. MySQL comes with a text-based client by default, but there are graphical clients available, as well as ODBC drivers to allow you to interact with a MySQL database from Windows applications such as Microsoft Access.
The command line client can be invoked from the command line with the mysql command. The mysql command takes a database name as a required argument, as well as other optional arguments such as -p, which causes the client to ask for a password for access to the database if access controls have been set up.
You can see all the options available on the command line by typing mysql --help.
Advanced: You can set up access controls on a database by editing the data in the mysql database (i.e. type mysql mysql on the command line) or by using the mysqlaccess command. Type mysqlaccess --help for more information about this command.
% mysql -p databasename Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 3.21.33b Type 'help' for help. mysql>
The MySQL client allows you to type in commands on one or many lines. When you finish a statement, type ; to end, same as for Perl.
To quit the client, type quit or \q.
For a full outline of commands available in the client, type help or \h. It will give you this message:
mysql> \h MySQL commands: help (\h) Display this text ? (\h) Synonym for `help' clear (\c) Clear command connect (\r) Reconnect to the server. Optional arguments are db and host edit (\e) Edit command with $EDITOR exit (\) Exit mysql. Same as quit go (\g) Send command to mysql server print (\p) print current command quit (\q) Quit mysql rehash (\#) Rebuild completion hash status (\s) Get status information from the server use (\u) Use another database. Takes database name as argument Connection id: 1 (Can be used with mysqladmin kill)