登录
$ mysql -uroot -p
列出所有数据库
show databases;
创建数据库
CREATE DATABASE abccs;
切换数据库
use databasename;
查看当前数据库
SELECT database();
列出所有表
show tables;
查看表结构
desc tablename;
创建用户
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
给用户授权
GRANT privileges ON databasename.tablename TO 'username'@'host'
GRANT ALL ON *.* TO 'bell'@'%';