MySQL database connection command

Start the database service

Format: net start database name

net start  mysql57

 

Close the database service

Format: net stop database name

net stop mysql57

 

Link local database

mysql  -u  root  -p

Note: do not want to connect to mysql, mysql server must be provided that in the activated state

After executing the above command, you need to enter a password (original password set during installation) to proceed to the next mysql environment.

 

Set to allow remote connections

1. Go to mysql: mysql -u root -p

2. Enter your password

3.mysql>use  mysql;

4.mysql>update  user  set   host="%" where  user="root";

5.mysql>flush  privileges;

(Flush privileges; refresh and update data)

 

Connect to a remote database

Format: mysql -h ip address -u user name -p

mysql -h  10.10.25.159  -u   root   -p

 

Check the version of MySQL

select  version();

MySQL statements to a good end points

(sql statement to execute in the environment mysql mysql> to the next, if the first command -> represents the statement is completed)

Exit Database

quit; or exit;

 

Guess you like

Origin www.cnblogs.com/dyd520/p/11411050.html
Recommended