MYSQL Command cmd operation, mysql Command cmd

Source: Internet
Author: User

MYSQL Command cmd operation, mysql Command cmd

Today, let's take a look at the various database commands. the following commands are all input from the command line in the CMD command window. First, if you enter mysql, the system prompts "mysql is not an internal command or an external command. This is actually the reason why the environment variables are not set. For example, if the installation directory of mysql is C: \ news \ mySql, enterC: \ news \ mySql \ MySQL Server 5.5 \ bin, Restart CMD, and then enter mysql, and the operation should be normal. Of course, the premise is that the mysql service should be started normally, if the command is not started, the command will display cannot connect th ..........

First, mysql statements are case-insensitive. Let's look at the first command:

Mysqladmin-uroot-p123 password 456

In this statement, the root password is changed to 456. The original password is 123,-u indicates the user name, followed by the root user name, -p indicates that the second sign of the password is the logon password, and the space in the middle can be omitted. The space between password and new password cannot be omitted.

1.1 connect to a remote database. The basic format is as follows:

Mysql-h computer name (IP address)-u user name-p Password

For example, if my database is local and the IP address of the database is 127.0.0.1, you can write it as follows:

Mysql-h 127.0.0.1-u root-p 123

1.2 MySQL permission management:

1.3 add new users

First, log on to the mysql database. After the root user logs on, select the database before adding a new user,

> Use database_name; // select a database

The following steps are run together until the end ends with a semicolon. The enter key does not end the command! It is the end sentence that requires a semicolon and press Enter.

> Grant all

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.