linux 學習第二十天(mariadb配置)

1、mariadbmysql

yum install mariadb mariadb-serversql

systemctl restart mariadb數據庫

systemctl enable mariadbide

 

mysql_secure_installation  (初始化mysql)rest

 

MariaDB [(none)]> set password=password('redhat');  (數據庫登陸後,修改mariadb數據密碼)server

 

MariaDB [mysql]> create user dream@localhost identified 'redhat';  (建立dream用戶和密碼)blog

 

grant select,update,delete,insert on mysql.* to dream@localhost;  (添加dream用戶elect,update,delete,insert權限)io

 

revoke select,update,delete,insert on mysql.* from dream@localhost;  (刪除dream用戶elect,update,delete,insert權限)mariadb

 

create database rise;  (建立rise數據庫)table

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';  (單獨刪除王五記錄)

相關文章
相關標籤/搜索