mariadb

阿里云centos7.3学生机安装jdk、mariadb、tomcat

放肆的年华 提交于 2020-01-23 21:25:31
一、安装jdk (1)下载解压安装包 由于1.8版本适用范围最广,这里安装jdk1.8版本,先下载安装包。 附百度云下载链接 链接:https://pan.baidu.com/s/1_A1pCLXvCMs5SxmpHPPYfg 提取码:4e9h 在/usr/local/目录下创建一名为java的文件夹,将安装包移入该文件夹。 先转到需要解压的目录下 cd /usr/local/java 解压安装包 tar -zxvf jdk-8u231-linux-x64.tar.gz (2)添加环境变量 打开配置文件 vim /etc/profile 输入i进行编辑 在末尾加入 export JAVA_HOME=/usr/local/java/jdk1.8.0_231 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin export PATH=$PATH:${JAVA_PATH} 编辑完毕后ctrl+c,输入:wq!回车退出 使配置文件生效 source /etc/profile (3)查看是否配置成功 分别输入java -version和$JAVA_HOME

mysql多表查询

对着背影说爱祢 提交于 2020-01-23 20:29:07
文章目录 union, union all cross join inner join left [outer] join right [outer] join 自连接 三张表内连接 子查询 union, union all -- 第一张表与第二张表纵向地合并,有去重的功能 MariaDB [ hellodb ] > select * from teachers - > union - > select stuid,name,age,gender from students ; MariaDB [ hellodb ] > select * from teachers union select * from teachers ; -- 纵向合并不去重 MariaDB [ hellodb ] > select * from teachers union all select * from teachers ; cross join -- 交叉连接 ( 横向笛卡尔 ) MariaDB [ hellodb ] > select * from students cross join select * from teachers ; inner join MariaDB [ hellodb ] > select * from students inner join teachers on

Mysql查询

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-23 17:03:15
文章目录 mysql 单表查询示例 mysql 单表查询示例 MariaDB [ hellodb ] > select * from students ; MariaDB [ hellodb ] > select name as 姓名,age 年龄,stuid from students ; MariaDB [ hellodb ] > select name as 姓名,age 年龄,stuid from students as 学生表 ; MariaDB [ hellodb ] > select * from students where stuid >= 20 ; MariaDB [ hellodb ] > select * from students where stuid < > 20 ; MariaDB [ hellodb ] > select * from students where name = 'xu zhu' ; MariaDB [ hellodb ] > select * from students where age > 10 and gender = 'f' ; -- sql 注入 MariaDB [ hellodb ] > select * from user where username = 'admin' and password = '' or

MySQL Join based on YEAR () indexing - Column add or Generated Column

一世执手 提交于 2020-01-23 12:08:10
问题 Based on the answer https://stackoverflow.com/a/1601812/4050261 I am using SQL query as below FROM workdone LEFT JOIN staffcost ON YEAR(workdone.date) = staffcost.costyear The above query does not make use of index which I have on workdone.date column and hence very slow. I have 2 options, i presume Option 1 Add another column workdone.year which is updated through table oncreate and onupdate event. Use this column in the query. Option 2 Add Generated (Virtual/Persistent) column workdone.year

[MariaDB]MHA高可用部署-实验

牧云@^-^@ 提交于 2020-01-23 03:32:27
目录 一、简介 1.1MHA角色 二、MHA的工具 三、MHA部署过程 3.1.1 配置 3.1.2 环境规划 3.1.3 配置一主多从 3.2 MHA配置 3.2.1 master权限授予 3.2.2 ssh互信 3.2.3 安装mha包 3.2.4 MHA管理节点配置 3.2.5 MHA节点检测 3.2.6 MHA启动 3.2.7 MHA模拟故障 3.2.8 修复已损坏的节点加入MHA中 MHA 问题集锦 一、简介 MHA的逻辑是,为了保证其MySQL的高可用,会有一个StandBy状态的master.在mysql故障切换的过程中,MHA 能做到在 0~30 秒内自动完成 数据库 的故障切换操作,并且在进行故障切换的过程中,MHA 能最大程度的保证数据的一致性,以达到相对意义上的高可用。 1.1MHA角色 如下图,整个 MHA 架构分为 MHA Manager 节点 MHA Node 节点 其中 MHA Manager 节点是单点部署,MHA Node 节点是部署在每个需要监控的 MySQL 集群节点上的。MHA Manager 会定时探测集群中的 Master 节点,当 Master 出现故障时,它可以自动将最新数据的 Standby Master 或 Slave 提升为新的 Master,然后将其他的 Slave 重新指向新的 Master。 二、MHA的工具

mysql实现MHA高可用详细步骤

∥☆過路亽.° 提交于 2020-01-23 03:22:30
一、工作原理 MHA工作原理总结为以下几条: (1) 从宕机崩溃的 master 保存二进制日志事件(binlog events); (2) 识别含有最新更新的 slave ; (3) 应用差异的中继日志(relay log) 到其他 slave ; (4) 应用从 master 保存的二进制日志事件(binlog events); (5) 通过Manager控制器提升一个 slave 为新 master ; (6) 使用其他的 slave 连接新的 master 进行复制。 概念 二、实现过程 MHA 对 MYSQL 复制环境有特殊要求,例如各节点都要开启二进制日志及中继日志,各从节点必须显示启用其read-only属性,并关闭relay_log_purge功能等,这里对配置做事先说明。 机器名称 IP配置 服务角色 备注 Manager 10.0.0.44 Manager控制器 用于监控管理 Master 10.0.0.41 数据库主服务器 开启bin-log relay-log 关闭relay_log_purge Slave1 10.0.0.42 数据库从服务器 开启bin-log relay-log 关闭relay_log_purge Slave2 10.0.0.43 数据库从服务器 开启bin-log relay-log 关闭relay_log_purge 1

Uncaught exception 'PDOException' with message 'SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value

荒凉一梦 提交于 2020-01-23 02:33:30
问题 This is the error I am getting. PDOException: Uncaught exception 'PDOException' with message 'SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF0\x9F\x98\xB3' for column 'string' at row 1' I know the problem here. The column table is using utf8 . The utf8 encoding cannot store 4 byte characters so it errors. A way to get around this could be to use utf8mb4 instead. My question instead is about the error message. We are using MariaDB. Why does it say "Invalid datetime

mariadb password and unix_socket authentication for root

a 夏天 提交于 2020-01-23 01:10:53
问题 I've a root User on the MariaDB on Ubuntu 16.04. As default the root user is authenticated by the unix_socket authentication plugin. I can switch the authentication method to password method by setting update mysql.user set plugin='' where user='root'; This works fine. But ... Is there a possibility to authenticate the root user by unix_socket (by root shell) or by password (when it is connected by localhost:3306)? 回答1: A reliable and straightforward way would be to create another super-user

OpenStack-rocky 安装部署(one-controller + one-compute)

旧城冷巷雨未停 提交于 2020-01-22 22:02:38
系统版本为Centos7.5 内存均分配:4G 存储:40G CUP:1核(根据电脑实际情况分配) 准备两台电脑或虚拟机(配置两张网卡) 192.168.2.188 192.168.2.190 准备 ###查看时区 date ###修改时区 timedatectl set-timezone Asia/Shanghai结果是:Mon Jul 8 17:25:28 CST 2019 ###修改语言环境 查看语言 locale 查看系统拥有的语言包 locale -a yum install kde-l10n-Chinese vi /etc/locale.conf ##加下面内容到第一行,设置中文 LANG=zh_CN.UTF8 方法(二)(该命令会修改上面配置的值) localectl set-locale LANG=en_US.UTF-8 ###查看网卡UUID (修改第二块网卡的配置/etc/sysconfig/network-script/ifcfg-enp0s8) 在/etc/sysconfig/network-script/目录下复制ifcfg-enp0s3为ifcfg-enp0s8,并修改相关的配置 nmcli con show ###安装文件上传工具 yum install -y lrzsz ###关闭防火墙 ###我的建议是先关闭防火墙,等配置好了,再去设置防火墙

MariaDB数据库基本操作

二次信任 提交于 2020-01-22 12:28:38
1、CMD打开执行命令:mysql -u root -p 输入数据库密码,进入数据库 PS C:\Users\admin> mysql -u root -p Enter password: **** Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 11 Server version: 10.4.7-MariaDB mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 2、执行show databases; ,查看MariaDB的数据库结构。 MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | django | | information_schema | | mysql | | performance_schema |