MySQL备忘录

  1. 进入mysql
    mysql -u root -p
  2. 更改默认编码方式为UTF-8
    http://blog.csdn.net/red4711/article/details/6007248
  3. 备份和还原
    http://blog.csdn.net/quietprofound/article/details/2947197
  4. 常见指令
show databases; --显示当前数据库
create database mybuaa; --新建数据库
use mybuaa; --使用数据库
--创建数据表
drop table if exists entries;
create table entries (
  id integer primary key auto_increment,
  amount integer not null,
  description text not null,
  money integer not null,
  people text not null,
  exedate date not null
);
insert into entries values(1,-255,'水费',-140,'孟德超',CURDATE());--增
delete from entries where id = 1;   --删
update entries set people = "孟德超" where id = 1;--改
select people,exedate from entries where id = 1;--查

drop table entries; --删除表单
drop mybuaa; --删除数据库
  1. 其他
    数据类型:http://www.runoob.com/mysql/mysql-data-types.html
    外键:http://www.cppblog.com/wolf/articles/69089.html

你可能感兴趣的:(Web)