Centos7.4-mariadb
笔记
yum install mariadb mariadb-server
set password = passwd(‘linuxprobe’); |
【修改数据库密码】 |
create user 用户名@主机名 inentified by ‘linuxprobe’; |
【创建数据库账户】 |
create database cdskill; |
【创建数据库】 |
use cdskill; |
【进入数据库】 |
create table exam (ID int(3) primary key anto_increment,name varchar(10) NOT NULL,birthday datetime,sex char(6) default 'M',password char(100)); |
【primary key主键,anto_increment自增, NOT NULL将Null值改为NO,default 'M'把default值改为M,】 |
insert into exam values('1','stu1','2003-11-10','man',password('stu1')); |
【往exam表单导入表单,password字段的数据用password函数进行加密】 |
select * from exam; |
【显示exam表中所有记录】 |
select * from exam where Name='stu1'; |
【搜索exam表内名为stu1的记录】 |
update exam set sex='woman' where Name='stu1'; |
【将名为stu1,的性别更新为woman】 |
delete from exam where Name = 'stu1'; |
【将stu1的记录删除】 |
drop table exam; |
【将名为exam的表删除】 |
drop databse cdskill; |
【将名为cdskill的数据库删除】 |
grant all on *.* to [email protected] identified by '123456'; |
【创建一个名为ding的本地用户,密码为ding】 |
GRANT ALL ON *.* TO '' |
|
flush privileges; |
【刷新权限】 |
参考网址:
https://blog.****.net/woqutechteam/article/details/81115892
https://www.jb51.net/article/23258.htm