//连接数据库; mysql -uroot -hlocalhost -p //修改数据库密码; use mysql; update user set password=password("123456") where user="root"; FLUSH PRIVILEGES; //数据库增删改查 crud(增加create,查询read,修改update,删除delete); //创建表; create table carmack_on( id int auto_increment primary key, name varchar(30) not null, user varchar(30) not null, password varchar(40) not null)character set gbk collate gbk_chinese_ci; //修改列名字; alter table carmack_on change name namer int; //增加列; alter table carmack_on add ok varchar(30); //删除列; alter table carmack_on drop ok; //修改列属性; alter table goods modify id varchar(40); //修改表名字; rename table carmack_on to carmack_one; //修改库名字(数据表转到新库); rename table carmack_on to test.carmack_on;
//增数据 insert into carmack_one (name,user) values ("王凯","root");//如果要增加所有字段值可省略字段名顺序不乱 //删数据 delete from carmack_one where 1//删除一定要条件比较严格不可逆; //改数据 update carmack_one set user="gaihao" where 1; //查数据 select *{列名} from carmack_one where 1{条件 1位默认}//where fenshu>=90;