Bootstrap Component +mysql

Source: Internet
Author: User
Tags mysql client mysql in create database

Day content:
Components in 1.bootstrap

2.bootstrap Plug-in
1. First clear the timer with the timer
2. First stop () with animation

3.mysql Installation and use

Socket Service Side

Hold
How to save a user name and password

Db
User.txt
ID username pwd
1alex 123


Scoket Client
Username Alex
PWD 123


MySQL in fact it is based on the socket client and server software


MySQL Service side
-Open the service side

-Parse MySQL command
-Create folder creation file add data (record) (local file operation)



MySQL Client
-Connecting to the service side
-Send MySQL command (MySQL syntax)


(1) Installation of MySQL
-Unzip the downloaded MySQL archive to the specified directory
-Add the path of the bin directory to the environment variables of the system
-Create Window Service

mysqld--install installing MySQL software service
Mysqld--remove

-MYSQLD--initialize-insecure initialization operation generates a data folder

-Turn on MySQL server
net start MySQL open MySQL server
net stop MySQL shutdown

-Client Connection Service
Mysql-uroot-p



(2) Commands for common databases (folders)
View all data: show databases;

Create databases db1:create database DB1;

Delete databases: drop database db1;


To create a table:
CREATE TABLE T1 (
ID int,
Name Char (10)

);

Inserting data

INSERT into T1 values (1, ' Alex ');

INSERT into T1 values (2, ' Alex2 '), (3, ' alex3 ');


Query data:

SELECT * from T1;
Select id from t1;
Select Id,name from T1;
Select name from T1;



Data type:
Integral type: The default is signed unsigned unsigned


Int (3) The display width of 3 refers to integral type



CREATE TABLE Consumer (
ID int,
Name varchar (50),
Sex enum (' Male ', ' female ', ' other '),
Level enum (' Vip1 ', ' vip2 ', ' vip3 ', ' vip4 '), #在指定范围内, choose one more
Fav set (' Play ', ' music ', ' read ', ' study ') #在指定范围内, multi-Select
);


Insert into consumer (ID,NAME,SEX,LEVEL,FAV) VALUES (1, ' Alex ', ' other ', ' vip1 ', ' play,music ');



INSERT into consumer values (2, ' alex2 ', ' female ', ' vip2 ', ' study ');

INSERT into consumer (ID) values (3);




Small integer type: tinyint
Integral type: int
Large integral type: bigint

Single precision: float
Double precision: Double
Accurate accuracy: decimal

Char: fixed length
VARCHAR: variable length

Enum: Enum multiple selection One

Set: Set multiple selection One

Time Type: aggregation function now () datatime


CREATE TABLE Department2 (
ID int,
Name Char (10),
Unique (ID),
Unique (name)
);


CREATE TABLE Services (
ID int,
IP char (15),
Port int,
Unique (ID),
Unique (Ip,port)
);


Single row unique
ID Name Port
u u u

The current column is different

Federated (Multi-column) unique
can be inserted as long as one column is different

ID Name Port
u u

CREATE TABLE Services (
ID int,
IP char (15),
Port int,
Unique (ID),
Unique (Ip,port)
);

INSERT INTO services values
(1, ' 192,168,11,23 ', 80),
(2, ' 192,168,11,23 ', 81),
(3, ' 192,168,11,25 ', 80);


CREATE TABLE T14 (
ID int Primary_key auto_increment,
Name varchar (NOT NULL)
);

Insert into T14 (name) VALUES (' John Doe '), (' Harry ')


CREATE TABLE T15 (
ID int not NULL unique auto_increment,
Name varchar (NOT NULL)
);

# FOREIGN Key

# Create a primary table (associated table)
CREATE TABLE DEP (
ID int PRIMARY KEY,
Name varchar () is not NULL,
Descripe varchar () NOT NULL
);
CREATE TABLE Dep2 (
ID int PRIMARY KEY,
Name varchar () is not NULL,
Descripe varchar () NOT NULL
);


CREATE TABLE EMP (
ID int PRIMARY KEY,
Name varchar () is not NULL,
The age int is not NULL,
dep_id int,
dep2_id int,
Constraint FK_DEP foreign KEY (dep_id) references dep (ID)
ON DELETE Cascade
On UPDATE Cascade,
Constraint FK_DEP2 foreign KEY (dep2_id) references Dep2 (ID)
ON DELETE Cascade
On UPDATE Cascade,
);

Many-to-many
CREATE TABLE book (
ID int primary KEY auto_increment,
Name varchar (20)
);
Create TABLE author (
ID int primary KEY auto_increment,
Name varchar (20)
);

CREATE TABLE Author2book (
ID int not NULL unique auto_increment,
author_id int NOT NULL,
book_id int NOT NULL,
Constraint Fk_author foreign KEY (author_id) references author (id)
ON DELETE Cascade
On UPDATE Cascade,
Constraint Fk_book foreign KEY (book_id) references book (ID)
ON DELETE Cascade
On UPDATE Cascade,
Primary KEY (AUTHOR_ID,BOOK_ID)
);

Insert into book (name) values
(' Nine-yang Martial "),
(' Nine Yin Scriptures '),
(' Nine Yin Bones claw '),
(' Solitary Nine Swords '),
(' Dragon 10 Spank '),
(' Sunflower Treasure Collection ')
;



Demo of MySQL:
Installation of MySQL see: http://www.cnblogs.com/Neeo/p/8624286.html

0, after the installation of MySQL, see the service here there are two, I now use MYsql57 this, the Save database path is: C:\ProgramData\MySQL\MySQL Server 5.7\data. The MySQL Save database path is: C:\Program files\mysql\mysql Server 5.7\data

1, Mysql-uroot-p

2, \s

3. Show global variables like "%datadir%" (C:\ProgramData\MySQL\MySQL Server 5.7\data)

4.

CREATE TABLE User (

ID int,

Username varchar (50),

Password varchar (10)

);

5, show tables;

6.

mysql> ALTER TABLE ' user ' Add primary key (' id ');

Query OK, 0 rows affected (0.42 sec)

records:0 duplicates:0 warnings:0



Bootstrap Component +mysql

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.