maridb

Maridb

yum intall mariadb-server -y  ##安装mariadb服务

systemctl start mariadb    ##开启服务

vim /etc/my.cnf     ##修改配置文件

systemctl  restart  mariadb  #重启服务

mysql_secure_installtion   ##mysql加密

Enter current password for root (enter for none):   ##数据库原始密码,直接回车

Change the root password? [Y/n] y  ##是否设定数据库root密码

New password:               ##输入密码

Re-enter new password:         ##重复密码

Remove anonymous users? [Y/n] y  ##是否删除匿名用户访问权限

Disallow root login remotely? [Y/n] y  ##是否禁止超级用户远程登录

Remove test database and access to it? [Y/n] y   ##是否删除测试数据

Reload privilege tables now? [Y/n] y     ##重新加载服务

数据库的基本sql语句操作

(1)登录

mysql -uroot -p    ##-u代表用户  -p密码

(2)查询

show databases;     ##显示数据库

use mysql;        ##进入mysql库

show tables;       ##显示数据库里表的名称

select * from user;    ##查询user表中所有内容

desc linux;          ##查询表的结构 (显示表头)

(3)数据库的建立

create database westos;     ##建立westos库

create table linux(        ##建立Linux表,并且有username和password两个字段

username varchar(15) not null,

password varchar(15) not null

);

insert into linux values (‘user1‘,‘123‘)   ##给Linux表里写入内容

(4)数据库的更新

update linux set password=password(‘456‘) where username=‘user1‘;  ##加密更新user1密码

update linux set password=password(‘456‘) where (username=‘user2‘ or username=‘user3‘;  ##更新user2和user3密码

delete from linux where where username=‘user1‘;  ##删除user1密码

alter table linux add age varchar(4);     ##在Linux表最后添加age列

alter table linux add year varchar(4)after age ##在age字段后添加year字段

alter table linux drop age ;   ##删除age字段

(5)删除数据库

drop table linux    ##删除Linux表

drop database westos   ##删除westos库

(6)数据库的备份

mysqldump -u root -p123 --all -database  ##备份表中所有数据

mysqldump -u root -p123 --all -database --no-data  ##备份所有表,不备份数据

mysqldump -u root -p123 westos    ##备份westos库

mysqldump -u root -p123 westos > /mnt/westos.sql  ##备份westos库保存到westos.sql

mysqldump -u root -p123 westos linux > /mnt/linux.sql  ##备份westos库中的Linux表

mysql -u root -p123 -e "create database westoss;"  ##建立westos库

mysql -u root -p123 westos <  /mnt/linux.sql  ##导入数据到westos库

(7)用户授权

create user [email protected] identified by ‘ggg‘;  ##创建用户ggg,只能通过本机登录

create user [email protected]‘%‘ identified by ‘ggg‘;     ##创建用户ggg,只能通过网络登录

grant insert,update,delete,select on westos.linux to [email protected]  ##用户授权

revoke delete on westos.linux from [email protected]   ##删除用户授权

drop user [email protected]‘%‘   ##删除用户

(8)修改密码

mysqladmin -uroot -predhat password 123

mysqld_safe --skip-grant-table &  ##开启MySQL登录接口忽略授权表

mysql               ##不要密码登录

update mysql.user set Password=password(‘123‘) where User=‘root‘  ##更新root密码

ps aux | grep mysql ##过滤mysql进程并结束

kill -9   mysqlpid

systemctl start maraidb   ##重启MySQL

3.数据库网页管理工具

yum install httpd php phy-mysql -y  ##安装服务

systemctl start httpd

systemctl enable httpd

systemctl stop firewalld

systemctl disable firewall

tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2 -C /var/www/html ##解压文件到指定目录

mv  phpMyAdmin-3.4.0-all-languages/ mysqladim  ##重命名文件

cd mysqladim

cp -p config.sample.inc.php  config.inc.php  ##复制模板

vim  config.inc.php  ##编辑配置文件

修改配置文件内容

systemctl restart httpd

访问http://172.25.254.117/mysqladmin

ctrl+shift+delete   ##清除缓存

时间: 2024-07-31 14:26:14

maridb的相关文章

maridb安装不部署

maridb的安装 1.官网下载最新GA版本 wget http://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.18/source/mariadb-10.1.18.tar.gz 2.解压 tar -zxvf  mariadb-10.1.18.tar.gz 3.安装必要的组件 yum install ncurses-devel cmake  libxml2 libxml2-dev gcc-c++  -y 4.进入解压后的目录执行以下命令

maridb Error &#39;Operation DROP USER failed for

数据库版本:mariadb   10.0.12 主库删除多余的用户名,因从库没有此信息造成主从故障! 报错信息如下:Error 'Operation DROP USER failed for 'username'@'192.16.%' 多源复制的主从报错跳过: 根据mysql操作方式sql_slave_skip_counter = 1 ,执行不报错,但是sql_slave_skip_counter = 1 不会生效 多源主从跳错的操作如下: SET @@default_master_connec

centos 7 mini装maridb 10.1 binary版本

注:centos的版本为:CentOS-7-x86_64-Minimal-1503-01 http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1503-01.iso 下载maridb 10.1 binary: http://mirrors.opencas.cn/mariadb//mariadb-10.1.10/bintar-linux-x86_64/mariadb-10.1.10-linux-x86

【实战】maridb 10.0.15 on centos 6.5 安装

maridb 10.0.15 on centos 6.5 安装 ****************************************************************************** 1.系统部分 ****************************************************************************** --------1.desktop安装即可,选择自定义 选择下面两个包,其它根据自己需求选择 base s

Ubuntu配置OpenStack 二:配置时间同步NTP和安装数据库Maridb以及问题总结

继上一节Ubuntu配置OpenStack 一:配置主机环境,下面继续为安装时间同步,以及配置openstack的安装包源和安装数据库Maridb.(全文截图都是由自己徒手搭建完成并且截图) 第一节连接配置主机环境  http://www.cnblogs.com/skylarzhan/p/7702078.html 一.安装时间同步NTP NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机保持时间同步的一种协议,NTP客户端可以和NTP服务器的计算机时间保

linux安装maridb数据库jemalloc1依赖问题解决

linux安装maridb数据库jemalloc1依赖问题解决 一.安装环境 [email protected]:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic 二.报错信息 [email protected]:~# apt install mariadb-server-cor

Maridb/mysql 源码阅读1

转自 http://blog.csdn.net/theorytree/article/details/7335612 MySQL服务器的main()在/sql/main.cc,实际的入口点在/sql/mysqld.cc. 我们直接从mysqld_main()开始阅读. 先理解一些比较重要的宏定义: (1)宏HAVE_NPTL: 这个宏如果打开了会去读一个系统变量LD_ASSUME_KERNEL,并把他赋给一个全局变量ld_assume_kernel_is_set,这个系统变量设置了系统线程的实现

maridb(mysql) debian-sys-maint用户说明

debian-sys-maint中Debian系统对MySQL维护用的,可以理解为通过系统的某个“非常规”程序对Mysql进行备份恢复等行为时,改程序所使用的登录Mysql的账户. 这个debian-sys-maint用户只有Debian或Ubuntu服务器才有,所以如果您的服务器是Debain或Ubuntu,debian-sys-maint是个Mysql安装之后自带的用户,具体作用是重启及运行mysql服务.

关系型数据库之MariDB 10.0.10多主一从的架构及多线程复制架构

一.MySQL 5.6 以后出现的GTID:GTID概念: 1.GTID是一个由服务器的UUID和事务序号组成的唯一事务序号      例如: UUID:N          1122-3322-1122:1           1122-3322-1122:2 2.GTID会被当做唯每一个事务的首部,将会自动生成并存到二进制日志中3.GTID可以用来追踪主从之间的事务传输.4.GTID主要应用于HA的功能.在多主模型中,标示某一个事务是来源于哪个特定的主服务器.5.从服务器不会修改或者添加新的