Use the MYSQL command line to connect to the MYSQL database

Source: Internet
Author: User

You can use the MYSQL command line to implement many functions. The MYSQL command line described below is used to connect to the MYSQL database. If you have encountered any problems in this regard, take a look.

Format: mysql-h host address-u user name-p User Password

Or: mysql-u username-p // press enter and enter the password. The password is invisible.

1. Connect to the MYSQL command line on the local machine

First, open the DOS window, enter the mysql \ bin directory, type the mysql-u root-p command, and press enter to prompt you to enter the password. note that there can be spaces or spaces before the user name, but if-p is followed by the user password, there must be no space between-p and the password; otherwise, you will be asked to re-enter the password. for example, the following are valid logon attempts: (account: root Password: 123)
Mysql-u root-p
Mysql-uroot-p
Mysql-uroot-p123

If you have just installed MYSQL, the Super User root has no password, so press enter to enter MYSQL. The MYSQL prompt is: mysql>

2. Connect to the MYSQL command line on the remote host

Assume that the IP address of the remote host is 110.110.110.110, the user name is root, and the password is abcd123. Enter the following command:
Mysql-h110.110.110.110-u root-p 123; Note: Do not add spaces between u and root. The same applies to others)

3. exit MYSQL command: exit and press Enter)

MySQL permission table Introduction

Commands that grant MySQL user permissions

How to optimize mysql Indexes

How to view MySQL Indexes

Use of MySQL EXPLAIN statements

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.