1.Linux(CentOS 7.2)下安装与初始化
#安装 yum install mariadb-server
#设置编码 vim /etc/my.cnf
[MysqLd]
character-set-server=utf8
#启动 systemctl start mariadb
#自启动 systemctl enable mariadb
#停止 systemctl stop mariadb
#初始化 MysqL_secure_installation
#连接 MysqL -u root -p -h ip地址
#查看用户 select user,host from MysqL.user;
#创建用户 create user '用户'@'host'idendified by '密码';
或insert into MysqL.user (user,host,password) values ('MysqL','%',password('密码'));
#修改密码 update MysqL.user set password=password('新密码') where user='用户名';
部分版本上MysqL.user中没有password这一列,以上2句要稍作调整
#创建用户 insert into MysqL.user (user,host) values ('MysqL','%');
#修改密码 set password for 用户 = password('密码');
#授权 grant insert,update,select,delete on 数据库.* to 用户@'%';
#撤销权限 revoke delete on 数据库.* from 用户;
#更新权限 flush privileges;
3.常用操作
show variables like '%character%';
show databases;/show schemas;
use 数据库;
show tables;
show full columns from 表名;
原文链接:https://www.f2er.com/centos/378626.html