Mysql数据库

1、配置mariadb

yum install mariadb-server.x86_64 -y 
systemctl start mariadb 
systemctl enable mariadb 
netstat -antlpe | grep mysql 

在/etc/my.cnf中添加skip-networking=1 #禁止远程登陆
2、命令

show databases;         #显示数据库 
user mysql;             #进入mysql数据库 
show tables;           #显示库里的表 
desc table;            #显示表的描述 
select * from tableselect * from table where Host=‘127.0.0.1‘
mysql -uroot -predhat -e “show databases”
create database nono;##创建数据库 
use nono; 
create table Linux ( 
username varchar(30) not null, 
password varchar(30) not null, 
age varchar(3) ); ##创建表 
insert into linux values (‘nono’,’123’,’25’); ##添加表内容,字段的内容可以为空,但是不能少
alter table linux rename message; 修改表名 
alter table linux add class varchar(50); 
alter table linux add class varchar(50) after password; ##在password字段后添加class字段 
alter table linux drop class; ##删除class字段 
update linux set class=’linux’; ##修改linux表class字段为linux 
update linux set class=’Java’ where username=” and password=”; 
delete from linux where username=‘‘ and class=‘‘;##删除表中内容 
drop table linux;##删除表 
drop database nono;##删除数据库
mysqldump -uroot -predhat nono > /mnt/mj.sql 
mysql -uroot -p 
drop database nono; 
mysql -uroot -predhat -e “create database nono;” ##创建数据库nono
mysql -uroot -predhat nono < /mnt/mj.sql

备份

systemctl stop mariadb 
mysqld_safe –skip-grant-tables & ##j进入安全模式 
mysql -uroot 
use mysql; 
update user set Password=password(‘redhat’) where User=’root’; 
ps aux | grep mysql 
kill -9 3368 
kill -9 3526 
systemctl restart maruidb 

授权

create user client@localhost indentified by 'nono'
create user nono@'%' identified by 'redhat'
grant insert, update, delete on mariadb.* to client@localhost
grant select on mariadb.*nono@'%'
flush privileges
show grants for client@localhost
revoke delete, update on mariadb.*from client@localhost
drop user client@localhost

安装phpmyadmin

yum install httpd -y 
tar jxf phpMyAdmin-3.4.0-1-all-languages.tar.bz2 -C
/var/www/html 
mv phpMyAdmin-3.4.0-1-all-languages mysqladmin 
cd mysqladmin 
cp config.sample.inc.PHP config.inc.php 
less Documentation.txt 
vim config.inc.php 
yum install php php-mysql -y 
systemctl restart httpd 
firewall-config 
firewall-cmd --list-all 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值