mariadb

CentOS 7 安装 Apache PHP MariaDB

梦想的初衷 提交于 2020-01-30 19:18:20
准备篇: 一、配置防火墙,开启80端口、3306端口 CentOS 7 默认使用的是firewall作为防火墙,这里改为iptables防火墙。 1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 2、安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑防火墙配置文件 # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m

How can I create a foreign keys of text type in MariaDB or MySQL?

岁酱吖の 提交于 2020-01-30 11:06:55
问题 I have two tables: CREATE TABLE first_table( my_id TEXT(6) NOT NULL, content VARCHAR(30) NOT NULL, PRIMARY KEY(my_id(6)) ) Engine=InnoDB charset utf8mb4 collate utf8mb4_general_ci; CREATE TABLE second_table( another_id TEXT(6) NOT NULL, my_id TEXT(6) NOT NULL, another_content VARCHAR(30) NOT NULL, PRIMARY KEY(another_id(6)) ) Engine=InnoDB charset utf8mb4 collate utf8mb4_general_ci; But in the second table I can't create a foreign key that references the first table, first I've tried this:

How can I create a foreign keys of text type in MariaDB or MySQL?

旧街凉风 提交于 2020-01-30 11:05:13
问题 I have two tables: CREATE TABLE first_table( my_id TEXT(6) NOT NULL, content VARCHAR(30) NOT NULL, PRIMARY KEY(my_id(6)) ) Engine=InnoDB charset utf8mb4 collate utf8mb4_general_ci; CREATE TABLE second_table( another_id TEXT(6) NOT NULL, my_id TEXT(6) NOT NULL, another_content VARCHAR(30) NOT NULL, PRIMARY KEY(another_id(6)) ) Engine=InnoDB charset utf8mb4 collate utf8mb4_general_ci; But in the second table I can't create a foreign key that references the first table, first I've tried this:

Student absent for 5 consecutive days excluding Holidays

微笑、不失礼 提交于 2020-01-30 04:04:57
问题 I am using code igniter and attendance table as below: attendance ID timestamp student_id status 1 01-01-20 1 P 2 01-01-20 2 P 3 02-01-20 1 P 4 02-01-20 2 A 5 03-01-20 1 P 6 03-01-20 2 A 7 04-01-20 1 H 8 04-01-20 2 H 9 05-01-20 1 P 10 05-01-20 2 A My target is to get the student id who is absent for 3 consecutive days for the period of the last 1 month from today excluding the holidays in the middle like in the above table the student id 2 should be the one with 3 consecutive absence

Student absent for 5 consecutive days excluding Holidays

给你一囗甜甜゛ 提交于 2020-01-30 04:04:16
问题 I am using code igniter and attendance table as below: attendance ID timestamp student_id status 1 01-01-20 1 P 2 01-01-20 2 P 3 02-01-20 1 P 4 02-01-20 2 A 5 03-01-20 1 P 6 03-01-20 2 A 7 04-01-20 1 H 8 04-01-20 2 H 9 05-01-20 1 P 10 05-01-20 2 A My target is to get the student id who is absent for 3 consecutive days for the period of the last 1 month from today excluding the holidays in the middle like in the above table the student id 2 should be the one with 3 consecutive absence

MariaDB 使用正则匹配查询

你。 提交于 2020-01-30 02:54:20
正则表达式通常被用来检索或替换那些符合某个模式的文本内容,根据指定的匹配模式匹配文本中符合要求的特殊字符串.例如从一个文本文件中提取电话号码,查找一篇文章中重复的单词或者替换用户输入的某些敏感词语等,这些地方都可以使用正则表达式,正则表达式强大且灵活,可以应用于非常复杂的查询,MySQL中使用 REGEXP 关键字指定正则表达式的字符匹配模式,先来看一下下表常用的正则规则吧: 通配符 说明信息 匹配例子 ^ 匹配文本的开头字符 '^b'匹配开头是b的字符串 $ 匹配文本的结束字符 'st$'匹配结尾是st的字符 . 匹配任意单个字符 'b.t'匹配任意b和t之间有1个字符 * 匹配0个或多个任意字符 'f*n'匹配字符n前面任意个字符f + 匹配前面字符1次或多次 'ba+'匹配以b开头后面紧跟至少1个a [^] 匹配不在括号中的任何字符 '[^ab]'匹配开头不包括,a或b字幕的 匹配包含指定字符串的文本 'aaa'匹配字符串aaa [字符集合] 匹配字符集合中任意1个字符 '[xz]'匹配x或者z 字符串{n,} 匹配前面字符至少出现n次 'b{2}'匹配2个或多个b 字符串{n,m} 匹配前面字符至少出现n次不大于m次 'b{2,3}'匹配最少2个,最多3个b 以上就是MariaDB所支持的所有匹配通配符,这里内容虽然较少,但是还是要独立出来一个章节

centos7安装MariaDB

十年热恋 提交于 2020-01-28 21:18:50
文章参考 Centos7安装 mariadb 最新版 centos7 yum配置安装Mariadb数据库(使用国内Mariadb源) 如何在Linux中更改默认的MySQL / MariaDB端口 centos7不再支持mysql,需要改装MariaDB。以下是整理的MariaDB安装流程 一、首先设置数据源 以下命令直接粘贴复制即可 cat << EOF > /etc/yum.repos.d/mariadb.repo [ mariadb ] name = MariaDB baseurl = http://mirrors.aliyun.com/mariadb/yum/10.4/centos7-amd64/ gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB enabled = 1 gpgcheck = 1 EOF 二、更新缓存 依旧是粘贴复制 yum clean all yum makecache yum repolist 三、安装MariaDB yum -y install MariaDB-server MariaDB-client 其他常用命令 1、设置开机启动 systemctl enable mariadb 2、启动MariaDB systemctl start mariadb 3、重启 systemctl

centos 7.6 安装MariaDB

浪尽此生 提交于 2020-01-28 13:55:39
yum install mariadb-server systemctl start mariadb systemctl enable mariadb mysql_secure_installation 此处设置的是数据库root密码,和系统root无关。 开始root密码默认为空,直接回车,然后设置root密码 mysql -u root -p use mysql; select host, user from user; update user set host='%' where host='上面命令你自己看到的主机名'; flush privileges;修改vim配色方案 cd ~ vim .vimrc colorscheme desert 修改服务器字符集 vim /etc/my.cnf 在mysqld节下 character-set-server=utf8mb4 show variables like "%character%";show variables like "%collation%"; 来源: https://www.cnblogs.com/alantop/p/12237864.html

centos7安装mysql(MariaDB)

拈花ヽ惹草 提交于 2020-01-27 07:53:07
1.centos7现状:   新系统无法再使用yum install mysql-server来安装mysql,因为已使用mariadb代替mysql。 2.安装mariadb:    [root@localhost ~]# yum -y install mariadb* Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.linode.com * extras: mirrors.linode.com * updates: mirrors.linode.com Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.37-1.el7_0 will be installed ---> Package mariadb-bench.x86_64 1:5.5.37-1.el7_0 will be installed ---> Package mariadb-devel.x86_64 1:5.5.37-1.el7_0 will be installed ---> Package mariadb-embedded.x86_64 1:5.5.37-1

CentOS 7 通过yum安装MariaDB

こ雲淡風輕ζ 提交于 2020-01-27 01:19:16
以下操作都以 root 用户进行操作 以下操作都以 root 用户进行操作 以下操作都以 root 用户进行操作 安装 安装 mariadb 服务 # yum install -y mariadb-server 安装 mariadb 命令行客户端 # yum install -y mariadb 安装 mariadb C library # yum install -y mariadb-libs 安装 mariadb 开发包 # yum install -y mariadb-devel 更改配置 更改 /etc/my.cnf.d/client.cnf 文件 [client] 下加一行配置 default-character-set=utf8 最终内容 # # These two groups are read by the client library # Use it for options that affect all clients, but not the server # [client] default-character-set = utf8 # This group is not read by mysql client library, # If you use the same .cnf file for MySQL and MariaDB, # use it