Basic mysql operations

Source: Internet
Author: User


I plan to write some knowledge about database operations. Now I have finished the first article. The following describes the basic knowledge about mysql operations. In the window, start and stop the mysql service to start mysql Database net start mysql www.2cto.com stop mysql Database net stop mysql restart mysql Database net restart mysql command line form, use of mysql basic commands 1. Cancel the command \ c2, 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; www.2cto.com 5. select test database use test; 6. view the selected database select database (); 7. set the database Chinese encoding set names utf8; 8. create database test 9 and 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 insert into mtest ('name ', 'sex', 'email ', 'birth') values ('hangsan', '1', 'hangsan @ 163.com', now ()); www.2cto.com 11. Query Information in the mtest table where name is Zhang San. select * from mtest where name = 'hangsan '; 12. Output select * from mtest order by id desc in descending order of id; 13. select * from mtest id limit 10 to 20 data records displayed; Author: benpao

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.