GNU Info

Info Node: (mysql.info)Connecting-disconnecting

(mysql.info)Connecting-disconnecting


Next: Entering queries Prev: Tutorial Up: Tutorial
Enter node , (file) or (file)node

Connecting to and Disconnecting from the Server
===============================================

To connect to the server, you'll usually need to provide a MySQL user
name when you invoke `mysql' and, most likely, a password.  If the
server runs on a machine other than the one where you log in, you'll
also need to specify a hostname.  Contact your administrator to find
out what connection parameters you should use to connect (that is, what
host, user name, and password to use).  Once you know the proper
parameters, you should be able to connect like this:

     shell> mysql -h host -u user -p
     Enter password: ********

The `********' represents your password; enter it when `mysql' displays
the `Enter password:' prompt.

If that works, you should see some introductory information followed by
a `mysql>' prompt:

     shell> mysql -h host -u user -p
     Enter password: ********
     Welcome to the MySQL monitor.  Commands end with ; or \g.
     Your MySQL connection id is 459 to server version: 3.22.20a-log
     
     Type 'help' for help.
     
     mysql>

The prompt tells you that `mysql' is ready for you to enter commands.

Some MySQL installations allow users to connect as the anonymous
(unnamed) user to the server running on the local host.  If this is the
case on your machine, you should be able to connect to that server by
invoking `mysql' without any options:

     shell> mysql

After you have connected successfully, you can disconnect any time by
typing `QUIT' at the `mysql>' prompt:

     mysql> QUIT
     Bye

You can also disconnect by pressing Control-D.

Most examples in the following sections assume you are connected to the
server.  They indicate this by the `mysql>' prompt.


automatically generated by info2www version 1.2.2.9