一、mariadb yum install mariadb mariadb-server systemctl restart mariadb systemctl enable mariadb mysql_secure_installation (初始化mysql) MariaDB [(none)]> ...
一、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'; (單獨刪除王五記錄)