-- 查看有哪些用户 host: % 代表任意地址都可以登录 host: localhost 代表仅本地可以连接
select host,user from mysql.user; -- 建库
create database test charset utf8;
-- 刷新
flush privileges
-- 赋权
grant all on *.* to 'admin'@'%'; 将数据库的权限赋给admin用户 
-- 刷新
-- 查看建库过程
show create database test;
-- 选择数据库
use test;
-- 建表
create table test(
name varchar(20),
age int
);
-- 修改表名
alter table test rename new_test; -- 查看建表过程
show create table test;
  show create table test\G -- 格式化输出
-- 查看表结构
describe test; -- 等同show columns from user;
-- 查看表内容
select * from test;
-- 添加内容
insert into test values('tj',18);
insert into test(name) values('tj1');
insert into test(age) values(19);
insert into test(age,name) values(19,'tt');
insert into test values('a',1),('b',2);
-- 查看表内容
select * from test; -- 改内容update(可修改名字及数值)
update test set name='updat' where age=19; -- 不加条件则修改所有的
update test set age=20 where name = 'updat'; -- 不加条件则修改所有的
-- 查看表内容
select * from test; -- 删除内容delete
delete from test where age =1; -- 不加条件则删除整个表的内容
delete from test where age<=>null; -- 删除age为null的数据
-- 查看表内容
select * from test; -- 修改表结构及属性 add增加,change重命名,drop删除,modify修改
-- add 给表添加新的结构
alter table test add gender char(5) default '不知';
-- change 将表头名name 改为username
alter table test change name username varchar(20);
-- drop删除
alter table test drop age; -- 就没有了age属性
alter table test add age char(5) default 18 after username;
-- modify修改属性,不能修改名字
alter table test modify age char(6);
-- 查看建表过程
show create table test;
-- 查看表内容
select * from test; -- 常用的数值类型
create table test1(
a varchar(10) not null,
b char(10) default 'zz',
c text,
d int null,
e tinyint null,
f datetime default '2017-12-21 16:21:10'
);
describe test1;
insert into test1 values('tj','hello','hello',18,17,'1999-9-9 09:09:09');
select * from test1; -- drop table xxx 删除表
-- drop database * 删除所有表

msq_table's methods的更多相关文章

  1. How to implement equals() and hashCode() methods in Java[reproduced]

    Part I:equals() (javadoc) must define an equivalence relation (it must be reflexive, symmetric, and ...

  2. Sort Methods

    heyheyhey ~~ It has been a long time since i come here again...whatever today i will summerize some ...

  3. Top 10 Methods for Java Arrays

    作者:X Wang 出处:http://www.programcreek.com/2013/09/top-10-methods-for-java-arrays/ 转载文章,转载请注明作者和出处 The ...

  4. Don’t Use Accessor Methods in Initializer Methods and dealloc 【初始化和dealloc方法中不要调用属性的存取方法,而要直接调用 _实例变量】

    1.问题:    在dealloc方法中使用[self.xxx release]和[xxx release]的区别? 用Xcode的Analyze分析我的Project,会列出一堆如下的提示:Inco ...

  5. C# Extension Methods

    In C#, extension methods enable you to add methods to existing class without creating a new derived ...

  6. CLR via C# 3rd - 08 - Methods

       Kinds of methods        Constructors      Type constructors      Overload operators      Type con ...

  7. 转 Dynamics CRM Alert and Notification JavaScript Methods

    http://www.powerobjects.com/2015/09/23/dynamics-crm-alert-and-notification-javascript-methods/ Befor ...

  8. AX7: HOW TO USE CLASS EXTENSION METHODS

    AX7: HOW TO USE CLASS EXTENSION METHODS   To create new methods on a standard AX class without custo ...

  9. Keeping Async Methods Alive

    Consider a type that will print out a message when it’s finalized, and that has a Dispose method whi ...

随机推荐

  1. 安卓手机文件管理器简单横向评比 - imsoft.cnblogs

      X-plore文件管理器 个人评价:安卓手机上管理文件的神器,所有文件一览无余,加上自己对软件常用功能的配置,管理文件无比方便.(本人一直使用)   Solid文件管理器 个人评价:用户体验真的很 ...

  2. 部署tomcat到Linux

    1. alt+p   放文件 2.解压到自定义 apps文件夹中 tar -zxvf apache-tomcat-7.0.68.tar.gz -C apps 3.进入文件启动tomcat/bin ./ ...

  3. USB设备驱动_WDS

    1. usb_alloc_dev中的 bus_type 中指定了匹配函数,和uevent中的环境参数. ====>不同的bus_type的匹配函数可能是不同的,uevent的环境变量参数也可能是 ...

  4. 前端基础之CSS快速入门

    前一篇写了我们的Html的常用组件,当然那些组件在我们不去写样式的时候都是使用的浏览器的默认样式,可以说是非常之丑到爆炸了,我们肯定是不能让用户去看这样丑到爆炸的样式,所以我们在这里需要使用css样式 ...

  5. Linux下的Nginx部署禅道

    基本思路:先安装好nginx和mysql和php,上传禅道的源码.把禅道的源码包扔到 nginx/apache 的工程路径内或者nginx/apache内的配置文件指向nginx的路径,然后将ngin ...

  6. ThinkPHP5 控制器中怎么实现 where id = 2 or id = 3 这个查询语句?

    使用 whereOr whereIn();  (来自 ★C̶r̶a̶y̶o̶n-杭州 ) 为什么不用数组啊,array('eq', array(1,2),'or') (来自 supler)

  7. Apache+modjk布置tomcat集群

    一.版本: Apache: 2.2.14: 下载地址:http://archive.apache.org/dist/httpd/binaries/win32/ Mod_jk:tomcat-connec ...

  8. Django模板语言(常用语法规则)

    Django模板语言 The Django template language 模板中常用的语法规则 {最新版本的Django语法可能有改变,不支持的操作可能支持了.[HTML教程 - 基本元素/标签 ...

  9. Angular 4.0 安装组件

    安装组件 ng g componet 组件名

  10. 关于WCF

    凡是被DataMember声明修饰的属性,必须要有get和set访问器,靠靠靠!!!! 给接口加 XmlSerializerFormat 强制用xml序列化.