惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
量子位
博客园 - 司徒正美
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
腾讯CDC
大猫的无限游戏
大猫的无限游戏
V
Visual Studio Blog
I
InfoQ
D
Docker
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
宝玉的分享
宝玉的分享
G
Google Developers Blog
GbyAI
GbyAI
Y
Y Combinator Blog
有赞技术团队
有赞技术团队
H
Help Net Security

秋码分享

我是如何解决将 c++ 编译成可以在 node.js 中使用的 *.node,中间出现的一大堆问题的(指纹浏览器基石篇) eSIM Plus 爱沙尼亚手机号彻底翻车?“永久有效”悄然变成了一年! 接码平台 SMS-Activate 余额可以转移到新平台使用,截止日期:2026年1月29日 是时候将 hugo-theme-kiwi 主题提交到 themes.gohugo.io 站点上了 Flux2 刚开源就凉了?Z-Image 本地部署狠狠打了个样 声音的未来:Chatterbox —— 用「夸张度旋钮」提升表现力的开源 TTS 向导 还以为那只是换个背景?Qwen-Image-Edit 在 ComfyUI 中能做到更离谱的事 Windows 结合最新版 ComfyUI 部署阿里最新开源的 Qwen-Image 图像大模型 从零样本到跨场景:Seed-VC语音转换技术的革命性突破 大语音模型轻量化革命:MegaTTS3 如何重新定义文本生成语音的技术边界(windows篇) 竞赛级编程大模型OlympicCoder-7B之本地部署(Windows篇) 阿里开源了端到端全模态大模型Qwen-2.5-Omini-7B之本地部署(windows篇) 语音识别之whisper本地部署(实时语音之开篇) 甭管是个人还是企业都能部署的Mistral-Small3.1,远超同级别的模型 文生音乐开源项目DiffRhythm,8G显存本地部署之Windows篇 阿里QwQ-32B本地部署指南:用Ollama轻松运行320亿参数大模型 基于Qwen2.5大模型的Spark-TTS,零样本语音克隆,CPU可运行之本地部署(Windows篇) 智谱开源了文生图CogView4-6B模型,支持中文提示词之本地部署(Windows篇) 基于歌词生成整首歌的开源AI音乐模型,支持中、英、日、韩等多种语言,本地化部署YuE(windows篇) 阿里云开源的文生视频万相 Wan2.1之本地部署Wan2.1-T2V-1.3B模型 互动式开源AI图像编辑神器,Windows11本地部署 MagicQuill 本地部署Qwen2.5-VL-7B-Instruct多模态视觉大模型(Windows篇) 保持角色一致性的绘本生成AI开源项目之Story-Adapter本地部署Windows篇 本地部署 Stable Diffusion 3.5(最新 ComfyUI记录篇) 谁说Win7安装不了Node.js最新版的呢?都2025年,还不更新系统到Win11 vs code远程调试Linux服务器上的php代码 浏览器定制 | Windows11 编译 Chromium 133.0.6885.0(截稿前Chromium最新版之编译篇[一]) 不说是彻底搞懂,至少让你不再惧怕c/c++指针,以及各种奇葩指针变种 解决windows下php8.x及以上版本,在Apache2.4中无法加载CURL扩展的问题 在 Windows8.1 下编译 Chromium (103.0.5060.68 之三)
海外云服务器安装 MariaDB 10.6.X (Ubuntu 18.04 记录篇二)
一个游离于山间之上的江湖漫行者。A jungle wanderer who wanders above the mountain · 2024-09-04 · via 秋码分享

MariaDB 的由来(历史)

谈起新秀MariaDB,或许很多人都会感到陌生吧,但若聊起享誉开源界业界知名的关系型数据库——Mysql,想必混迹于互联网的人们(coder无不知晓

其实mariaDB是由Mysql分支出来的一个项目,而且同属于同一个作者(Michael Widenius)。或许你会纳闷,既然Mysql如此优秀,作者而又为什么再次创造出一个新的数据库呢?

谈起mariadb的诞生,那就不得不说Mysql命运多舛际遇咯!起初,Mysql以开源的形式瞬间火爆互联网圈,这其中就包括创造出 Java 的公司—— sun,彼时的他们亟需一套小巧且功能强大的数据库,来摆脱其他商业化数据库。故而,sun 公司看准了时机,斥巨资收购了彼时还处在蓬勃发展Mysql

时间一晃,来到了2009年,号称全球数据库巨头 Oracle以当时看来是天价的价格收购了sun 公司,作为sun 公司附庸品,当然也卖身新雇主Mysql再次改投公司,并非它所愿,实是无奈之举

倘若sun 公司没被Oracle收购,或许不会出现mariaDB,毕竟sun 公司创造出了java这一从它诞生以来稳居年度 program language(编程语言)排行榜前三,毫不夸张的说,它影响了一代的互联网的进程

事与愿违sun 公司终将被oracle 公司收购了。自打oracle公司并购了sun 公司,全球数以千万计Java Engineer,便开始为Java是否还会开源起了忧虑之心

果不其然,oracle 公司还是向java开刀了,他们修改了java的一些开源策略,如:商业授权……

也正源于此,作为Mysql的作者,不得不为mysql的未来而担忧。然而,现在的mysql已经属于Oracle 公司,看似开源出来,但Oracle 公司随时都有可能将它闭源化。可他唯一能做的就是从开源mysql开出一个分支,构建出一个新的数据库,而它将改进Mysql所出现的问题,虽然mariadb是由mysql作者主导的,但主要还是靠开源社区来贡献代码。

安装前准备

我们知道大多数开源软件,多多少少会使用第三方(开源工具类库)软件包。虽然,你的项目大可不必依赖第三方类库,完全由自己着手编码来实现,那也是没问题,但在编写完这些工具库时,你的项目引入之前,你总得为你所编写的类库unit test吧!

工具类库代码量不是非常庞大的话,由你自己编写,亲自做unit test,这都没什么,毕竟自己从零开始实现一个与第三方相似的工具类库,给自己带来的不单单是一种炫技感,更多的是成就感喜悦感

可倘若工具类库代码行数达到上万,甚至十来万行呢?此时的你,再想从头写起与第三方类库类似的功能,怕是力不从了吧!且不说编写那十来万行的代码所消耗的时间,而是在接下来的事,是需要对它做unit test,将会让你开始怀疑人生

一个开源项目/产品能赢得越来越多用户的追捧,其中最为重要的一点莫过于产品的迭代更新速度是否快于竞争对手/友商。

为了能使产品迭代更新上快于他人,产品的研发团队往往会将项目中公共模块抽取出来,形成一个工具类库,或是使用了第三方开源类库,从而降低了花在这上面的时间以及精力4,以便能够全身心的着眼于产品本身。

安装所需的软件包

至于安装mariaDB前,为何要安装software-properties-common这个软件包呢?其实你也是可以不安装这个依赖库,而是直接安装MariaDB,那也是没问题的!只是在安装MariaDB过程中,会出现Error,最终导致无法正常的安装MariaDB,而出现错误的原因却是当前Linux发行版还未安装某个软件包

为了使MariaDB能够继续的安装下去,你便按照error提示,安装MariaDB所需的第三方类库

既然是这样的话,我们何不将MariaDB所需的软件包提前安装呢!

apt install  software-properties-common -y

image-20240831145314383

添加 MariaDB 镜像仓库

无论你当前系统属于哪个Linux 发行版,使用在线安装软件时,总是会在当前系统的镜像库搜寻,以此来下载软件。

当然咯,系统里的镜像仓库的软件版本或许有些旧,毕竟某些软件更新迭代快,以至于Linux 发行版来不及去更新镜像仓库内的软件版本。

故而,我们可以将需要下载哪个版本的MariaDB添加到系统镜像仓库里面。

至于那个MariaDB key 是官方所要求的,你将它下载下来就对咯!

apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://mirrors.ustc.edu.cn/mariadb/repo/10.6/ubuntu bionic main'

image-20240831150007380

安装 mariadb-server 和 mariadb-client

热身的差不多了,是该真正露出本领的时刻了,此处应有振聋发聩的掌声,不绝于耳的那种掌声。

使用以下命令来安装MariaDBserverclient

apt install mariadb-server mariadb-client

image-20240831150404754

设置 Mariadb 的安全信息

在安装完MariaDB后,我们需要对它做些必要性的安全措施,比如:root密码、是否使用unix socket登陆、是否开启远程登陆……

mariadb-secure-installation

mariaDBroot密码默认是,所以在出现这句Enter current password for root (enter for none):提示时,你就直接按键盘上的Enter,也就是回车键

随后的Switch to unix socket authentication [Y/n],便是询问你是否开启unix socket 认证

紧接着一句Change the root password? [Y/n],问你是否改变root密码,毫无疑问,root密码是需要修改的!

接下来的便是Remove anonymous users?[Y/n] 这么一句,它问你是否移除匿名用户。

之后的一句Disallow root login remotely? [Y/n]n,则是是否禁止 root 远程登陆

再者便是Remove test database and access to it? [Y/n],征求你是否需要移除test 数据库和数据的许可。

尾随其后的Reload privilege tables now? [Y/n] Y,还是寻求你是否现在来重新加载 privilege表,以此来更新你上述所做的修改。

root0XXX:~# mariadb-secure-installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none): #直接按 Enter 键
OK, successfully used password, moving on...
Setting the root password or using the unix socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
...Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users?[Y/n] Y
...Success!
Normally, root should only be allowed to connect from 'localhost', This
nsures that
someone cannot guess
the root
password from the
network.
Disallow root login remotely? [Y/n]n
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] n
... skipping.
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
root@XXX:~#

查看 Mariadb 服务状态

我们可以使用以下命令来查看当前MariaDB服务的状态,虽然目前我们知道MariaDB正处于running中。

我们从下面的输出信息,也是可以看出当前的MariaDB服务正处于running中。

root@XXX:~# systemctl status mariadb
* mariadb.service - MariaDB 10.6.15 database server
   Loaded: loaded (/1ib/systemd/system/mariadb.service; enabled; vendor preset:enabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           |_migrated-from-my.cnf-settings.conf
   Active: active (running) since Sat 2024-08-31 15:03:05 +08; 22min ago
     Docs: man:mar1adbd(8)
		  https://mariadb.com/kb/en/library/systemd/
Main PID: 701 (mariadbd)
   Status: "Taking your SQL requests now..."
     Tasks: 8 (limit:4915)
   CGroup: /system.slice/mariadb.service
           |_701 /usr/sbin/mariadbd
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701):2024-08-31 15:03:05 0 [Note]
 InnoDB: File'./ibtmpl' size is now 12 MB.
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701]: 2024-08-31 15:03:05 0 [Note]
InnoDB: 10.6.15 started; log sequence number 42114; transaction id 14
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701]: 2024-08-31 15:03:05 0[Note] Plugin'FEEDBACK' is disabled.
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701]: 2024-08-31 15:03:05 0[Note)
InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib buffer pool
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701): 2024-08-31 15:03:05 0 [Note] InnoDB: Buffer pool(s) load completed at 240831 15:03:05
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701]:2024-08-31 15:03:05 0[Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-sec
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701]:2024-08-31 15:03:05 0[Note] Server socket created on IP:'127.0.0.1'.
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701):2024-08-31 15:03:05 0 [Note] /usr/sbin/mariadbd: ready for connections.
Aug 31 15:03:05 vps74437279.hosteons.com mariadbd[701]:Version: '10.6.15-MariaDB-1:10.6.15+maria~ubu1804'socket: '/run/mysqld/mysqld.sock'port: 3306mariadb.org b
Aug 31 15:03:05 vps74437279.hosteons.com systemd[1]: Started MariaDB 10.6.15 database server.
lines 1-23/23 (END)

设置开机自启动

查看 mariadb 版本

当你在Terminal输入mysql -u root -p的时候,你的脑袋是不是有那么一瞬间的迷糊,不禁纳闷,“我明明安装的是MariaDB,怎么会去使用mysql的命令呢?”

对于你的疑惑,作为MariaDB非官方人员的我,给出了这样的解释:

  • 1、上面有讲到MariaDB是由mysql分支而来的,难免有些命令还在使用mysql
  • 2、或许他们懒得将mysql命令修改成mariaDB了,毕竟MariaDB这都更新迭代了多少个版本,要改的话早就改了。(或许是旧版本还没改,新版本可能改了,也未可知。)

image-20240831154255135

添加用户及授权

grant all privileges on *.* to 'root'@'%' identified by 'YourPasswd';
flush privileges;