Mysql basic operations bitsCN.com start and stop mysql services under 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; bitsCN.com
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