MySQL command cmd operation

Source: Internet
Author: User

Today we will look at the various commands of the database, the following commands are all from the command line under the CMD Command Window input instructions, first if you enter MySQL, the system prompts "MySQL is not an internal command or external command." So this is actually the reason why the environment variable is not set up, for example, my MYSQL installation directory is C:\NEWS\MYSQL, then enter C:\news\mySql\MySQL Server in the system variable path path in the environment variable 5.5\bin , restart cmd, then input MySQL, should be able to operate normally, of course, if the MySQL service to start normally, if not started then CMD will show cannot CONNECT th ....

First, the MySQL statement is case-insensitive. Look at the first command:

mysqladmin-uroot-p123 Password 456

The meaning of this sentence is to change the root password to 456, the original password is 123,-u represents the user name, followed by the root user name,-p means the password after 123 is the login password, the middle of the space can be omitted. However, the space between the password and the new password cannot be omitted.

1.1, connect to the remote database, the basic format is as follows:

Mysql-h Computer name (IP address)-u user name-p password

For example, my database is local, the database IP address is 127.0.0.1, then you can write:

Mysql-h 127.0.0.1-u root-p 123

1.2. mysql Rights Management:

1.3. Add new users

First to log in to the MySQL database, root login after the first select the database and then add new user operations,

>use database_name; Select Database

The following steps are run in conjunction until the end of the semicolon, and the ENTER key does not cause the command to end! is to touch the semicolon press ENTER to indicate the end statement.

>grant All

MySQL command cmd operation

Related Article

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.