用户管理 新建用户 语法 CREATE USER 'username'@'localhost' IDENTIFIED BY 'password' 示例 mysql create user 'lisi'@'localhost' identified by '123123';Query OK, 0 rows affected (0.00 sec) username:将创建的用户名 localhost:
库的管理 创建库 create database [if not exists] 库名; 删除库 drop databases [if exists] 库名; 建库通用的写法 drop database if exists 旧库名;create database 新库名; 示例 mysql show databases like 'javacode2018';+
1.添加新用户 只允许本地IP访问 create user 'test'@'localhost' identified by '123456'; 允许外网IP访问 create user 'test'@'%' identified by '123456'; 刷新授权 flush privileges; 2.为用户创建数据库 create database t
主库执行 CREATE DATABASE test CHARACTER SET utf8 COLLATE utf8_general_ci;use test;create table if not exists h1 (id int(10) PRIMARY KEY AUTO_INCREMENT,name varchar(50) NOT NULL);insert into test.h1 values