Start and Stop the mysql service in the window
Start mysql database
Net start mysql
Stop a mysql database
Net stop mysql
Restart the mysql database
Net restart mysql
Command line format: use of basic mysql commands
1. Command Cancellation
\ C
2. Exit the mysql window.
Exit; or quit; or ctrl + c
3. view the database version number
Select version ();
4. display the existing database
Show databases;
5. Select test Database
Use test;
6. view the selected Database
Select database ();
7. Set the Chinese encoding of the database
Set names utf8;
8. Create a test Database
Create database test
9. Create an mtest table
Create table mtest (
Id tinyint (2) unsigned not null auto_increment,
Name varchar (20 ),
Sex char (1 ),
Email varchar (50 ),
Birth datetime,
Primary key (id)
);
10. Insert a data entry into the mtest table
Insert into mtest ('name', 'sex', 'email ', 'birth') values ('hangsan', '1', 'hangsan @ 163.com ', now ());
11. Query Information in the mtest table whose name is John
Select * from mtest where name = 'hangsan ';
12. Output in descending order by ID
Select * from mtest order by id desc;
13. Display 11th to 20 data records
Select * from mtest id limit 10, 10;