mysql download、install and use

一、Access link https://dev.mysql.com/downloads/mysql/,download mysql community server;java

二、Decompress the compressed package,copy my-default.ini and rename my.ini,add content :mysql

#########################################################
  [client]
  port=3306
  default-character-set=utf8
  [mysqld]
  port=3306
  character_set_server=utf8
  #安裝路徑
  basedir=D:\java\mysql
  #數據路徑
   datadir=D:\java\mysql\data
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    [WinMySQLAdmin]
   D:\java\mysql\bin\mysqld.exe
#########################################################
sql

 

三、Add environment variable(optional)spa

MY_HOME:3d

path:%MY_HOME%\binserver

 

四、Register Mysql as a Windows system service
blog

in cmdip

install:mysqld install MySQL --defaults-file="D:\java\mysql\my.ini"ci

uninstall:mysql removerem

五、start mysql service:net start mysql

 

access to cmd

mysql -u root                 {After setting the password:mysql -hlocalhost -uroot -p123456 }

create database sales;

use sales;

 

create table product_info(

product_id  varchar(32) not null,

product_name varchar(64) not null,

product_price decimal(8,2) not null,

product_stock int not null,

product_description varchar(64),

product_icon varchar(512),

category_type int not null,

create_time timestamp not null default current_timestamp ,

update_time timestamp not null default current_timestamp on update current_timestamp,

primary key (product_id)

);

 

 

create table product_category(

category_id int not null auto_increment,

category_name varchar(64) not null,

category_type int not null,

create_time timestamp not null default current_timestamp,

updata_time timestamp not null default current_timestamp on update current_timestamp,

primary key (catagory_id),

unique key equ_catagory_type(catagory_type)

);

 

Create table order_master(
order_id varchar(32) not null,
buyer_name varchar(32) not null,
buyer_phone varchar(32) not null,
buyer_address varchar(128) not null,
buyer_openid varchar(64) not null,
order_amount decimal(8,2) not null,
order_status tinyint(3) not null default '0',
pay_status tinyint(3) not null default '0',
create_time timestamp not null default current_timestamp,
update_time timestamp not null default current_timestamp on update current_timestamp,
Primary key (order_id),
Key idx_buyer_openid (buyer_openid)

);

Create table order_detail(detail_id varchar(32) not null,order_id varchar(32) not null,product_id varchar(32) not null,product_name varchar(64) not null,product_price decimal(8,2) not null,product_quantity int not null,product_icon varchar(512),create_time timestamp not null default current_timestamp,update_time timestamp not null default current_timestamp on update current_timestamp,Primary key(detail_id),Key idx_order_id(order_id));

相關文章
相關標籤/搜索