1. Getting started with mysql

Source: Internet
Author: User
Tags sql server query mysql tutorial

1. Getting started with mysql
I. Getting started with mysql

1 mysql-h localhost-u root-p123456 log on to the mysql server 2 show databases list all databases 3 use www select a www database 4 show tables List Data tables of the database 5 create table emp (id int auto_increment, name varchar (20), birdate date); Create an emp table with the id, name, and birdate fields 6 insert into emp values (null, 'libbin ', '2017-07-06 '); insert a data record 7 insert into emp values (null, 'libbin', '2017-07-06'), (null, 'Min ', '2017-07-07 ') insert multiple data entries 8 update emp set name = 'php' w Here name = 'libbin'; modify the data of a single field 9 delete from emp where name = 'php'; delete the Qualified Data 10 alter table emp modify name char (125 ); modify attributes of a single field. Note: modify cannot modify field name 11 alter table emp change name cname char (125); modify attributes of a single field, the field name can be modified 12 alter table emp modify name char (200) first | after birdate to modify attributes of a single field, and specify the modified Location 13 alter table emp add column sex tinyint (1) first | after name add a field, and you can specify its location 14 alter table emp delete co Lumn sex deletes a field 15 describe emp to view the structure of a table = desc emp16 show create table emp same as above, but for more details, 17 drop table emp deletes a table 18 select * from emp queries all data in the emp table 19 select name from emp queries only the name field 20 select distinct name from emp queries name non-duplicate data 21 select * from emp where name = 'php '; query data whose name condition is php 22 select * from emp where name = 'php' order by id desc | asc; condition and sort 23 select max (id), min (id ), sum (id) from emp query the maximum, minimum, and total id 24 select * from emp limit 2 only 2 Data Records 25 select * from emp limit 9, 10 from 10th data records, take 10 data records 26 select count (id) from emp, find the total number of data records. 27 select * from emp where id in (select id from emp where name = 'php' or name = 'lib') subqueries, first, query the id with name php or libin, and then query all data that can match the id through in 28 select. name, B. name from emp as a, emp as B where. id = B. id and. id = 100 inline (table join) 29 select. name, B. name from emp as a left join emp As B on. id = B. id where. id = 100 id 100 left join 30 select. name, B. name from emp as a right join emp as B on. id = B. id where. id = 100 right join 31 32 DCL: 33 grant select, insert on www. * to 'test' @ 'localhost' identified by '000000' create a user test with only the select and insert permissions for all the tables under www. The password is 123456 revoke insert on www. * from 'test' @ 'localhost' revoke test's insert permission 35 36 concat ('lil', 'bin') String concatenation function, you can directly splice the query result fields with 37 38 sel Ect '<? Php echo 100;?> 'Into outfile' c: // qqq. php' text output, which is a dangerous vulnerability 39 select load_file ('C: // qqq. php'); read a text

 


How to get started with mysql? According to your description, I will answer one by one: whether it is created locally or on another computer depends on whether you log on locally or on the network.
Mysql supports TCP/IP. The example database is used for practice.
Find a book and read it carefully.
MYSQL is a basic Mysql tutorial for beginners.

· How to use stored procedures and triggers to manage data [May September 13] · experience on MySQL coding [May August 23] · SQL Server 2005 CE basic overview [May August 17] · SQL Server executes SQL statements features of memory usage during [July 22, July 31] · method for parsing SQL Server transaction log compression and deletion [July 22, July 30] · handling of update errors after sql2005 is installed [July 22, July 30] · SQL Server and Oracle, comparison of the three types of databases in DB2 [] · common SQL syntax and Data Objects in ORACLE [] · creating a security policy for SQL Server [] · Quickly Understanding SELECT statements in the MySQL database [] · MYSQL error code list for beginners of databases [June 20] · MySQL 5.0 new feature tutorial stored procedure: lecture 2: stored procedures in the new MySQL June 17 tutorial [July 5.0: lecture 1 [July 22, June 16] · How to directly store images in the MySQL database [July 22, June 16] · SQL Server Query analyzer shortcut keys set [July 22, June 14]

Related Article

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.