mysql创建数据库myorder_MySQL 创建数据库、创建表、插入字段及其与通过Web 服务器交互时注意事项...

知识是一点一滴地积累的,MySQL数据库今天算是对我开启了一个新纪元。

今天我想讲的有两点:

1、MySQL 创建数据库、创建表、插入字段代码。

当然也可以通过可视化编程工具MyManagerLiteSetup.exe,但是今天是用的时候,却不能创建表中的数据。

# SQL Manager 2005 for MySQL 3.7.5.1

# —————————————

# Host : localhost

# Port : 3306

# Database : wirelessorder_db

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

/*!40101 SET NAMES gbk */;

SET FOREIGN_KEY_CHECKS=0;

CREATE DATABASE `wirelessorder_db`

USE `wirelessorder_db`;

#

# Structure for the `menutbl` table :

#

CREATE TABLE `menutbl` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`typeID` int(11) DEFAULT NULL,

`name` varchar(50) DEFAULT NULL,

`price` int(11) DEFAULT NULL,

`pic` varchar(100) DEFAULT NULL,

`remark` varchar(200) DEFAULT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

INSERT INTO `menutbl` (id,typeID, name, price, pic, remark) VALUES (null,1,'水煮鱼',20,'test','test'),

(null,2,'凉拌西红柿',10,'tets','test');

#

# Structure for the `menutypetbl` table :

#

CREATE TABLE `menutypetbl` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`name` varchar(20) DEFAULT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

#

# Structure for the `orderdetailtbl` table :

#

CREATE TABLE `orderdetailtbl` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`orderId` int(11) DEFAULT NULL,

`menuId` int(11) DEFAULT NULL,

`num` int(11) DEFAULT NULL,

`remark` varchar(200) DEFAULT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

#

# Structure for the `ordertbl` table :

#

CREATE TABLE `ordertbl` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`orderTime` varchar(30) DEFAULT NULL,

`userID` int(11) DEFAULT NULL,

`tableId` int(11) DEFAULT NULL,

`personNum` int(11) DEFAULT NULL,

`isPay` int(11) DEFAULT NULL,

`remark` varchar(200) DEFAULT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

#

# Structure for the `tabletbl` table :

#

CREATE TABLE `tabletbl` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`num` int(11) DEFAULT NULL,

`flag` int(11) DEFAULT NULL,

`description` varchar(100) DEFAULT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

#

# Structure for the `usertbl` table :

#

CREATE TABLE `usertbl` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`account` varchar(20) DEFAULT NULL,

`password` varchar(20) DEFAULT NULL,

`name` varchar(20) DEFAULT NULL,

`gender` varchar(20) DEFAULT NULL,

`permission` int(11) DEFAULT NULL,

`remark` varchar(200) DEFAULT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

#

# Data for the `menutbl` table (LIMIT 0,500)

#

COMMIT;

#

# Data for the `menutypetbl` table (LIMIT 0,500)

#

INSERT INTO `menutypetbl` (`id`, `name`) VALUES

(1,'热菜'),

(2,'凉菜');

COMMIT;

#

# Data for the `orderdetailtbl` table (LIMIT 0,500)

#

INSERT INTO `orderdetailtbl` (`id`, `orderId`, `menuId`, `num`, `remark`) VALUES

(1,1,2,1,'ok'),

(2,1,1,2,'ok');

COMMIT;

#

# Data for the `ordertbl` table (LIMIT 0,500)

#

INSERT INTO `ordertbl` (`id`, `orderTime`, `userID`, `tableId`, `personNum`, `isPay`, `remark`) VALUES

(1,'11:50:07 02:04',1,2,5,NULL,NULL),

(2,'11:13:07 04:04',1,3,2,NULL,NULL),

(3,'11:14:07 04:04',1,1,2,NULL,NULL);

COMMIT;

#

# Data for the `tabletbl` table (LIMIT 0,500)

#

INSERT INTO `tabletbl` (`id`, `num`, `flag`, `description`) VALUES

(1,1,1,'1'),

(2,2,1,'2'),

(3,3,1,'3'),

(4,4,0,'4'),

(5,5,0,'5');

COMMIT;

#

# Data for the `usertbl` table (LIMIT 0,500)

#

INSERT INTO `usertbl` (`id`, `account`, `password`, `name`, `gender`, `permission`, `remark`) VALUES

(1,'admin','123','tom','male',1,'test');

COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;

/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

2、在通过网络与远程或本地数据库交互时应该注意的问题。

android中访问网络经常会出现一些莫名奇妙的问题,目前归纳一下,本人觉得可能是

1)      没有在 AndroidManifest.xml 加Intent访问权限,一定得在AndroidManifest.xml文件加上网络访问权限!

2)        数据库里面一定要有东西,表一定要设计内容!否则你想通过数据库来验证登录时就会出现空指针异常或者其他异常。因为你是要通过数据库来验证的,数据库里没有东西,怎么验证??

3)       遇到向MySql数据库插入数据时编译器会爆有问题,而代码本身没问题。这时候你就需要注意了。

a、可能是字符编码的问题-----utf8与gbk,这时去MySQL安装目录下找到my.ini文件,把其中的

default-character-set=utf8 改为default-character-set=gbk。

b、要是还不行的话,可能是SQL语句太长,把比较长的SQL语句的截成两行使用试试。

4)       测试网络连接时总是出现错误,原因可能有:

a、  服务器(如Tomcat服务器)一直开着,但是改了配置文件后没有重启服务!这就得注意了,你没有重启服务那么服务器中记录的是你原来的信息,所以必须得重启服务器。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Copyright (C) 1999-2016 EMS Database Management Solutions, Ltd. All rights reserved. IMPORTANT: PLEASE READ THIS AGREEMENT CAREFULLY BEFORE USING THE SOFTWARE. END USER LICENSE AGREEMENT EMS Database Management Solutions, Ltd. ("EMS") agrees to provide the user ("USER") with a copy of this software product ("SOFTWARE"), and grants the USER a limited license to use the SOFTWARE. The software contains all files of the installation package except for the "Dump" folder contents. This LICENSE AGREEMENT ("LICENSE") defines what the USER may do with the SOFTWARE, and contains limitations on warranties, liabilities and remedies. This LICENSE may be revoked by EMS at any time without notice if the USER fails to comply with the terms of this LICENSE. The copyright and all other rights in the SOFTWARE shall remain with EMS. LICENSE OF SOFTWARE This LITE edition of SOFTWARE is a FREEWARE and may be used by the USER for any legal purposes for an unlimited period on unlimited number of computers without any restrictions. The LITE edition of SOFTWARE is fully functional and does NOT contain any ADWARE or SPYWARE. DISTRIBUTION OF SOFTWARE The LITE edition of SOFTWARE may be freely copied and distributed to other users without any restrictions. TERM OF LICENSE This LICENSE shall continue for as long as the USER uses the SOFTWARE and/or distributes the SOFTWARE according to the terms of this agreement. However, this LICENSE will terminate if the USER fails to comply with any of its terms or conditions. The limitations of warranties and liability set forth in this LICENSE shall continue in force even after termination. ACCEPTANCE OF THIS LICENSE AGREEMENT By downloading and/or installing this SOFTWARE, the USER agrees to the terms of this LICENSE. DISCLAIMER OF WARRANTY AND LIABILITY THE SOFTWARE AND THE ACCOMPANYING FILES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, EMS DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, LtdLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF PERFORMANCE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL EMS BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL OR INCIDENTAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION OR LOSS OF BUSINESS INFORMATION) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE. OTHER RESTRICTIONS The USER may not rent, lease, sublicense, translate, disassemble, reverse engineer, or de-compile the SOFTWARE, or modify or merge the SOFTWARE with any part of the software in another program. This LICENSE may not be assigned or otherwise transferred without the prior written consent of EMS. The "Dump" folder contents is licensed in accordance with GNU GPL license. INVALID PROVISIONS If any provision of this LICENSE shall be declared invalid or unenforceable, the remaining provisions of this LICENSE shall remain in full force and effect to the fullest extent permitted by law. In such event, each provision of this LICENSE which is invalid or unenforceable shall be replaced with a provision as similar in terms to such invalid or unenforceable provision as may be possible which is legal and enforceable. ENTIRE AGREEMENT This LICENSE is the entire agreement between EMS and the USER, and supersedes any other agreement, oral or written, and may not be changed except by a written signed agreement.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值