seivice mysql status : 查看sql服务是否开启
ps -e |grep -i mysql: 查看mysql的进程id
service mysql start: 启动sql服务
show databases/ tables: 查看所有数据库/表
use mysql: 选择数据库
desc tablename: 查看表结构,包括字段,格式,限制等
创建一个用户
insert into user(Host,User,Password) values(“localhost”,“test2”,“1234567”)
为用户授权
grant all privileges on db_test.* to test2@"%" identified by ‘123456’
如果赋予全部权限,privileges可不写,%表示所有主机都可访问,只在本机上可用localhost,
授权之后刷新系统权限:
flush privileges;
删除用户:
1、delete from user where User=“test2” and Host=“localhost”;
2、drop user test2@“localhost”
3、flush privileges;
待续