标签:创建表 ges emctl 建表 table database mysq let 高级
安装 205 yum install mariadb -y
206 yum install mariadb-server -y
207 systemctl restart mariadb
208 systemctl enable mariadb
初始化
mysql_secure_installation
查看数据库
show databases;
更改密码
MariaDB [(none)]> set password =password(‘linuxprobe‘);
创建账号
MariaDB [(none)]> create user xiaohe@localhost identified by ‘linuxprobe‘;
添加权限
MariaDB [(none)]> grant select,update,delete,insert on mysql.* to xiaohe@localhost ;
删除权限
MariaDB [(none)]> revoke select,update,delete,insert on mysql.* to xiaohe@localhost ;
增删改查
新建数据库
create database linuxprobe;
使用数据库
use linuxprobe;
创建表格
create table mybook(name char(15),price int, pages int);
增
insert into mybook(name,price,pages) values(‘linuxprobe‘, ‘60‘, ‘400‘);
查
select * from mybook;
改
update mybook set price=40;
删
delete from mybook;
高级查
select * from mybook where name=‘linuxprobe‘;
select name,price from mybook where name=‘linuxprobe‘;
select * from mybook where price>‘50‘;
数据库备份
mysqldump -u root -p linuxprobe >dbbackup.dump
数据库恢复
mysql -u root -p linuxprobe < dbbackup.dump
标签:创建表 ges emctl 建表 table database mysq let 高级
原文地址:https://blog.51cto.com/sampsondotqiu/2499126