Debian11 安装 MariaDB 作者: Hogwarts 发布于: 2023-01-04 更新于: 2023-01-11 分类: 默认分类 #一、安装 本文以 Debian11 为例,采用存储库安装方式。 安装版本为 MariaDB 10.6 本文为学习贴,配置低的VPS不建议用高版本数据库。MySQL的话5.7足够了。 ##1.1 存储库安装 sudo apt-get install apt-transport-https curl sudo curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 'https://mariadb.org/mariadb_release_signing_key.asc' sudo sh -c "echo 'deb https://mirrors.gigenet.com/mariadb/repo/10.6/debian bullseye main' >>/etc/apt/sources.list" sudo apt-get update sudo apt-get install mariadb-server ##1.2 了解MariaDB版本发行生命周期 MariaDB每两年发布一个长期的维护版本,每个长期维护的版本会提供5年的支持,每季度发布一个短期的维护版本,每个短期的维护版本会提供1年的支持。  #二、运行中的小问题 ##2.1 root下直接登录 root下输入 mysql 人家的情况 root@debian:~# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 俺的情况,以10.10.2为例 root@debian:~# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 31 Server version: 10.10.2-MariaDB-1:10.10.2+maria~deb11 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. MariaDB [(none)]> ##2.2 问题的原因 这是由于在MariaDB10.4.3及更高版本中,默认情况下会安装unix_socket身份验证插件,并且root用户会使用它,正是由于这个插件的原因导致,在localhost下无密码可以直接登录。 ##2.3 问题的解决 MariaDB [(none)]> ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("你的密码"); ##2.4 存在的问题 没有解决,在 MariaDB10.10.2 下输入 mysql 还是不需要密码。纠结中,待续。 #三、参考 - [Download MariaDB Server](https://mariadb.org/download/?t=repo-config&d=Debian+11+%22Bullseye%22&v=10.6&r_m=gigenet "Download MariaDB Server") - [MariaDB默认root无密码直接登录问题分析解决](https://blog.whsir.com/post-6795.html "MariaDB默认root无密码直接登录问题分析解决") - [一文了解MariaDB版本发行生命周期](https://blog.whsir.com/post-6898.html "一文了解MariaDB版本发行生命周期") - [解决 MariaDB 默认root无密码就可以登录的问题](https://www.orcy.net.cn/1410.html "解决 MariaDB 默认root无密码就可以登录的问题") 标签: mariadb, mysql