mysql 常用语句

创建数据库:


CREATE DATABASE IF NOT EXISTS `test2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;


创建用户:

CREATE USER 'test1'@'localhost' IDENTIFIED BY 'test1';


赋予用户访问某个数据库:

grant ALL on db_caiwu.* to  'test'@'localhost'  identified by '123456';