Skip to content

MariaDB

MariaDB

image-20240419082021314

目录

[toc]

官网

maridb.org 官方

https://mariadb.org/

image-20240328131059861

RC:测试阶段了。

2024年3月28日

image-20240328131600396

FAQ

mariadb版本

  • Server version: 10.5.24-MariaDB MariaDB Server
bash
[root@linux ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 22
Server version: 10.5.24-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

[root@linux ~]# netstat -antlp|grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      25471/mariadbd      
[root@linux ~]# 

[root@linux ~]# systemctl status mariadb
 mariadb.service - MariaDB 10.5.24 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Thu 2024-03-28 15:41:05 CST; 14h ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 25486 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 25459 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 25457 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 25471 (mariadbd)
   Status: "Taking your SQL requests now..."
    Tasks: 9 (limit: 32440)
   Memory: 101.6M
   CGroup: /system.slice/mariadb.service
           └─25471 /usr/sbin/mariadbd

Mar 28 21:33:14 linux mariadbd[25471]: 2024-03-28 21:33:14 15 [Warning] Aborted connection 15 to db: 'unconnected' user: 'una...cation)
Mar 28 21:33:14 linux mariadbd[25471]: 2024-03-28 21:33:14 16 [Warning] Aborted connection 16 to db: 'unconnected' user: 'una...cation)
Mar 28 22:38:02 linux mariadbd[25471]: 2024-03-28 22:38:02 17 [Warning] Host name 'rorefah.cn' could not be resolved: Name or...t known
Mar 28 22:38:02 linux mariadbd[25471]: 2024-03-28 22:38:02 17 [Warning] Aborted connection 17 to db: 'unconnected' user: 'una...cation)
Mar 29 00:28:23 linux mariadbd[25471]: 2024-03-29  0:28:23 18 [Warning] IP address '198.235.24.122' could not be resolved: Na...t known
Mar 29 00:28:23 linux mariadbd[25471]: 2024-03-29  0:28:23 18 [Warning] Aborted connection 18 to db: 'unconnected' user: 'una...cation)
Mar 29 01:08:27 linux mariadbd[25471]: 2024-03-29  1:08:27 19 [Warning] Aborted connection 19 to db: 'unconnected' user: 'una...cation)
Mar 29 01:56:25 linux mariadbd[25471]: 2024-03-29  1:56:25 20 [Warning] Aborted connection 20 to db: 'unconnected' user: 'una...cation)
Mar 29 05:41:43 linux mariadbd[25471]: 2024-03-29  5:41:43 21 [Warning] Host name 'scanner-202.hk2.censys-scanner.com' could ...t known
Mar 29 05:41:43 linux mariadbd[25471]: 2024-03-29  5:41:43 21 [Warning] Aborted connection 21 to db: 'unconnected' user: 'una...cation)
Hint: Some lines were ellipsized, use -l to show in full.
[root@linux ~]#
  • 老师的,10.4.13

image-20240329054808257

image-20240329055019184

  • 重新安装
bash
https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.4.33/centos7-amd64/

yum remove -y mariadb-server

10.5.24-1.el7.centos

cat > /etc/yum.repos.d/mariadb.repo << EOF 
[mariadb]
name = MariaDB
baseurl = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.4.33/centos7-amd64/
gpgcheck = 0
EOF

yum clean all
yum makecache
yum repolist all


##2、部署
yum install -y mariadb-server --disableexcludes=MariaDB
systemctl enable --now mariadb

##3、测试
#mysql
  • 重装后的10.4.33版本果然是mysqld进程的

image-20240329060344093

bash
[root@vm-template ~]#netstat -antlp|grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      34103/mysqld        
[root@vm-template ~]#

image-20240329060451405

可以看到mysqld这个进程是以mysql用户来运行的。

查看某个进程的父进程:ps -auxf

image-20240329060700233

image-20240329060831346

这里的l代表多线程。

pstree -p

image-20240329061153353

bash
……
mysql:x:998:996:MySQL server:/var/lib/mysql:/sbin/nologin
[root@vm-template ~]#cat /etc/passwd

mysql客户端工具:

bash
[root@linux-test ~]#which mysql
/usr/bin/mysql
[root@linux-test ~]#rpm -qf `which mysql`
MariaDB-client-10.4.33-1.el7.centos.x86_64
[root@linux-test ~]#

这个mysql客户端可以连接本机的数据库,也可以连接远程数据库。

连接本机数据库,是不需要任何用户名/密码验证的哦:

bash
[root@linux-test ~
Welcome to the Mar
Your MariaDB conne
Server version: 10


Copyright (c) 2000


Type 'help;' or '\


MariaDB [(none)]>

查看mariadb支持的文件大小

bash
[root@vm-template ~]#cd /app/mysql/
[root@vm-template mysql]#ls
bin      COPYING.thirdparty  data  EXCEPTIONS-CLIENT  INSTALL-BINARY  man         README.md     scripts  sql-bench
COPYING  CREDITS             docs  include            lib             mysql-test  README-wsrep  share    support-files
[root@vm-template mysql]#ls support-files/
binary-configure  my-huge.cnf             my-large.cnf   my-small.cnf         mysql-log-rotate  policy     wsrep_notify
magic             my-innodb-heavy-4G.cnf  my-medium.cnf  mysqld_multi.server  mysql.server      wsrep.cnf
[root@vm-template mysql]#


head my-huge.cnf;echo -e;head my-large.cnf ;echo -e;head my-small.cnf

image-20240419082421762

生产里这些肯定是要改的

cat /etc/my.cnf

image-20240419082710870

bash
[mysqld]
port            = 3306
socket          = /data/mysql/mysql.sock
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

mariadb tcp 3306

bash
[root@linux ~]# netstat -antlp|grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      25471/mariadbd

好多公司都在用mariadb了

在开源界对mysql前景不怎么看好。 好多公司都在用mariadb了。

哈哈:鄙视链 percona server>mariadb>mysql

但目前大多数公司用mysql还是比较多的。

关于我

我的博客主旨:

  • 排版美观,语言精炼;
  • 文档即手册,步骤明细,拒绝埋坑,提供源码;
  • 本人实战文档都是亲测成功的,各位小伙伴在实际操作过程中如有什么疑问,可随时联系本人帮您解决问题,让我们一起进步!

🍀 微信二维码

x2675263825 (舍得), qq:2675263825。

image-20230107215114763

🍀 微信公众号

《云原生架构师实战》

image-20230107215126971

🍀 个人博客站点

https://onedayxyy.cn/

🍀 语雀

https://www.yuque.com/xyy-onlyone

🍀 csdn

https://blog.csdn.net/weixin_39246554?spm=1010.2135.3001.5421

image-20230107215149885

🍀 知乎

https://www.zhihu.com/people/foryouone

image-20230107215203185

最后

好了,关于本次就到这里了,感谢大家阅读,最后祝大家生活快乐,每天都过的有意义哦,我们下期见!

声明

作者:One

版权:此文章版权归 One 所有,如有转载,请注明出处!

链接:可点击右上角分享此页面复制文章链接

上次更新时间:

最近更新