Mysql uses the command line to connect to and disconnect the server

Source: Internet
Author: User
This article describes how to use the command line to connect to and disconnect a database. To connect to the server, a mysql User name and password are usually required when MySQL is called. To connect to the server MysqlA MySQL User name and a password are usually required. If the server runs on a machine other than the login server, you must specify the host name. Contact the administrator to find the connection parameters (that is, the connected host, user name, and password ). After you know the correct parameters, you can connect them as follows:

shell> mysql -h host -u user -pEnter password: ********

Host and user respectively represent the host name and MySQL account user name running on the MySQL server. Replace the value with the correct one. * ******* Indicates your password.MysqlShow Enter password: Enter it when prompted.

If valid, you should see some introduction information after the mysql> prompt:

shell> mysql -h host -u user -pEnter password: ********Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 25338 to server version: 5.1.2-alpha-standardType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>

Mysql> the prompt tells you that mysql is ready to enter the command for you.

SomeMySQLThe installation allows anonymous (Untitled) users to connect to the server running on the local host. If your machine is in this situation, you should be able to call it without any options.MysqlConnect to the server:

shell> mysql

After successful connection, you can enter QUIT (or \ q) at the mysql> prompt to exit at any time:

mysql> QUIT
In Unix, you can also press control-D to disconnect the server.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.