linux 学习第二十天(mariadb配置)
一、mariadb
yum install mariadb mariadb-server
systemctl restart mariadb
systemctl enable mariadb
mysql_secure_installation (初始化mysql)
mariadb [(none)]> set password=password('redhat'); (数据库登录后,修改mariadb数据密码)
mariadb [mysql]> create user dream@localhost identified 'redhat'; (创建dream用户和密码)
grant select,update,delete,insert on mysql.* to dream@localhost; (添加dream用户elect,update,delete,insert权限)
revoke select,update,delete,insert on mysql.* from dream@localhost; (删除dream用户elect,update,delete,insert权限)
create database rise; (创建rise数据库)
create table students(name char(15),age int,grade int); (创建students数据表)
desc students; (查看数据表字段)
插入记录
insert into students values('zhangsan',18,80);
insert into students values('lisi',22,70);
insert into students values('wangwu',30,88);
select * from students; (查询所有记录)
update students set age=10 where name='zhangsan'; (修改张三age字段记录)
mysqldump -u root -p rise > rise.dump (数据库备份)
delete from students; (删除rise数据库中表记录)
mysql -u root -p rise < rise.dump (数据库还原)
delete from students where name='wangwu'; (单独删除王五记录)
上一篇: 总是被雷人爸妈给逗笑
下一篇: Hive基础测试操作