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