mysql常用语句

创建用户

1
2
grant all privileges on testDB.* to test@localhost identified by 'test';
flush privileges; //刷新系统权限表

删除用户

1
2
Delete FROM user Where User='test' and Host='localhost';
flush privileges;

创建数据库

1
create database db_name default character set utf8 collate utf8_general_ci;

删除数据库

1
drop database dbname;

添加数据

1
insert into test(test_id,test_name) values(1,'test');

修改数据

1
UPDATE test SET test_name='test1' WHERE test_name='test';