<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MariaDB 安装]]></title><description><![CDATA[<h1>从零开始安装</h1>
<p dir="auto">爱来自 <em>Dabian</em></p>
<h3>清理旧环境</h3>
<pre><code>sudo apt-get purge mariadb* mysql*
sudo apt-get autoremove
</code></pre>
<h3>原地起飞</h3>
<ol>
<li>安装依赖：</li>
</ol>
<pre><code>sudo apt update
sudo apt install -y dirmngr ca-certificates apt-transport-https curl
</code></pre>
<ol start="2">
<li>导入 MariaDB 签名密钥：</li>
</ol>
<pre><code>sudo curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 'https://mariadb.org/mariadb_release_signing_key.asc'
</code></pre>
<ol start="3">
<li>安装 MariaDB Server</li>
</ol>
<pre><code>sudo apt update
sudo apt install -y mariadb-server
</code></pre>
<ol start="4">
<li>执行安全加固脚本，设置 root 密码</li>
</ol>
<pre><code>sudo mariadb-secure-installation
</code></pre>
]]></description><link>https://blog.clouldon.com/topic/21/mariadb-安装</link><generator>RSS for Node</generator><lastBuildDate>Thu, 11 Jun 2026 08:31:14 GMT</lastBuildDate><atom:link href="https://blog.clouldon.com/topic/21.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 May 2026 02:33:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MariaDB 安装 on Sat, 16 May 2026 02:34:07 GMT]]></title><description><![CDATA[<h3>轻量化配置</h3>
<p dir="auto"><em>针对 <s>50MB</s> 极小 内存目标</em></p>
<pre><code class="language-bash">sudo nano /etc/mysql/mariadb.conf.d/99-lightweight.cnf
</code></pre>
<pre><code class="language-ini">[mysqld]
# 核心：关闭性能监控，立省约 40MB+
performance_schema = OFF

# 存储引擎：将缓冲池压到最低 (适用于轻量 PHP 项目)
innodb_buffer_pool_size = 16M
innodb_log_buffer_size = 2M
innodb_flush_log_at_trx_commit = 2
innodb_stats_on_metadata = OFF

# 连接与线程：降低堆栈消耗
max_connections = 15
thread_stack = 192K
thread_cache_size = 0

# 临时表与缓存：防止内存突发占用
tmp_table_size = 2M
max_heap_table_size = 2M
table_open_cache = 400
table_definition_cache = 400

# 日志：禁用不必要的日志
skip-log-bin
</code></pre>
<pre><code class="language-bash">sudo systemctl restart mariadb
</code></pre>
<p dir="auto">查看内存情况</p>
<pre><code class="language-bash">ps aux | grep mariadbd | grep -v grep | awk '{print $6/1024 " MB"}'
</code></pre>
<blockquote>
<p dir="auto">!作为个人博客使用及时不配置其内存占用也较低，实际上配置了之后内存占用并没有降低多少，全站负载500MB!&lt;</p>
</blockquote>
]]></description><link>https://blog.clouldon.com/post/82</link><guid isPermaLink="true">https://blog.clouldon.com/post/82</guid><dc:creator><![CDATA[四折光曲]]></dc:creator><pubDate>Sat, 16 May 2026 02:34:07 GMT</pubDate></item><item><title><![CDATA[Reply to MariaDB 安装 on Sat, 16 May 2026 02:33:54 GMT]]></title><description><![CDATA[<h3>创建数据库 &amp; 用户</h3>
<ol>
<li>登录</li>
</ol>
<pre><code class="language-bash">sudo mariadb
</code></pre>
<ol start="2">
<li>新建</li>
</ol>
<pre><code class="language-sql">-- 1. 创建数据库，指定字符集为 utf8mb4 以支持中文
CREATE DATABASE `2233` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- 2. 创建用户并设置密码
CREATE USER '2233'@'localhost' IDENTIFIED BY 'YOURPASSWORD';

-- 3. 将数据库 2233 的所有权限授予用户 2233
GRANT ALL PRIVILEGES ON `2233`.* TO '2233'@'localhost';

-- 4. 刷新权限使配置立即生效
FLUSH PRIVILEGES;

-- 5. 退出
EXIT;
</code></pre>
<ol start="3">
<li>验证</li>
</ol>
<pre><code class="language-bash">mariadb -u 2233 -p
</code></pre>
<p dir="auto">成功进入后，运行 <code>SHOW DATABASES;</code> 能看到数据库 <em>2233</em></p>
]]></description><link>https://blog.clouldon.com/post/81</link><guid isPermaLink="true">https://blog.clouldon.com/post/81</guid><dc:creator><![CDATA[四折光曲]]></dc:creator><pubDate>Sat, 16 May 2026 02:33:54 GMT</pubDate></item></channel></rss>