Mysql数据库
来源:互联网 发布:ubuntu 重装ssh 编辑:程序博客网 时间:2024/05/29 17:30
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 table; select * 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;” ##创建数据库nonomysql -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@localhostgrant select on mariadb.*nono@'%'flush privilegesshow grants for client@localhostrevoke delete, update on mariadb.*from client@localhostdrop 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
- mysql 数据库
- MYSQL数据库
- mysql数据库
- mysql数据库
- mysql数据库
- MySql数据库
- 数据库:MySQL
- mysql 数据库
- Mysql数据库。。
- MySQL数据库
- MySql 数据库
- mysql数据库
- Mysql数据库
- mysql数据库
- MySQL数据库
- mysql数据库
- MySql数据库
- MySQL数据库
- 基于方法的权限控制
- Java中随机抽取List集合中特定个数的子项
- 如何使用C++递归来实现在BST(Binary Search Tree)里将所有的叶子节点上的数字求和
- 欢迎使用CSDN-markdown编辑器
- 百度UEditor编辑器使用教程与使用方法
- Mysql数据库
- 逐级解构层级关系数据
- Android的NDK开发(4)————JNI数据结构之JNINativeMethod
- 一周HTML5以及CSS的学习
- SpringMVC 的拦截器配置示例
- 编程题目练习-翻牌
- [SMOJ2206]圆桌问题
- 知识管理——学习篇
- HTML浮动与定位方式详解