<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mysql &#8211; 元几录</title>
	<atom:link href="https://blog.dpean.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.dpean.com</link>
	<description></description>
	<lastBuildDate>Wed, 09 Jul 2025 09:58:31 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>

<image>
	<url>https://blog.dpean.com/wp-content/uploads/2025/08/cropped-logo-1-150x150.png</url>
	<title>Mysql &#8211; 元几录</title>
	<link>https://blog.dpean.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Ubuntu MariaDB 局域网内访问慢</title>
		<link>https://blog.dpean.com/%e7%9f%a5%e8%af%86/ubuntu-mariadb%e5%b1%80%e5%9f%9f%e7%bd%91%e5%86%85%e8%ae%bf%e9%97%ae%e6%85%a2/</link>
		
		<dc:creator><![CDATA[dpecain]]></dc:creator>
		<pubDate>Mon, 10 Mar 2025 06:25:04 +0000</pubDate>
				<category><![CDATA[知识]]></category>
		<category><![CDATA[Mysql]]></category>
		<guid isPermaLink="false">https://dpean.com/?p=152</guid>

					<description><![CDATA[原因：DNS服务器变更地址引起。默认安装的Mariadb开启&#8230;]]></description>
										<content:encoded><![CDATA[
<p class=" eplus-wrapper"><strong>原因</strong>：DNS服务器变更地址引起。默认安装的Mariadb开启了DNS的反向解析。</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 0 16px;font-size:0.8em;width:100%;text-align:left;background-color:#282A36;font-style:italic;color:#f6f6f4"><span style="border-bottom:1px solid rgba(251, 251, 239, 0.2)">Bash</span></span><span role="button" tabindex="0" data-code="cd /etc/mysql/mariadb.conf.d
vi 50-server.cnf" style="color:#f6f6f4;display:none" aria-label="复制" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">/etc/mysql/mariadb.conf.d</span></span>
<span class="line"><span style="color: #62E884">vi</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">50</span><span style="color: #E7EE98">-server.cnf</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 0 16px;font-size:0.8em;width:100%;text-align:left;background-color:#282A36;font-style:italic;color:#f6f6f4"><span style="border-bottom:1px solid rgba(251, 251, 239, 0.2)">JSON</span></span><span role="button" tabindex="0" data-code="skip-name-resolve #取消注释，作用为禁用DNS解析" style="color:#f6f6f4;display:none" aria-label="复制" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F6F6F4">skip-name-resolve #取消注释，作用为禁用DNS解析</span></span></code></pre></div>



<p class=" eplus-wrapper"></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MySql 安全配置 mysql_secure_installation</title>
		<link>https://blog.dpean.com/%e7%9f%a5%e8%af%86/mysql%e5%ae%89%e5%85%a8%e9%85%8d%e7%bd%aemysql_secure_installation/</link>
		
		<dc:creator><![CDATA[dpecain]]></dc:creator>
		<pubDate>Sun, 09 Mar 2025 15:27:55 +0000</pubDate>
				<category><![CDATA[知识]]></category>
		<category><![CDATA[Mysql]]></category>
		<guid isPermaLink="false">https://dpean.com/?p=79</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 0 16px;font-size:0.8em;width:100%;text-align:left;background-color:#282A36;font-style:italic;color:#f6f6f4"><span style="border-bottom:1px solid rgba(251, 251, 239, 0.2)">JSON</span></span><span role="button" tabindex="0" data-code="NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
//建议在生产环境中使用的所有 MariaDB 服务器上运行此脚本的所有部分！请仔细阅读每一步！

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.
//为了登录 MariaDB 并进行安全设置，我们需要 root 用户的当前密码。如果您刚刚安装了 MariaDB，并且尚未设置 root 密码，您可以直接在这里按回车键。

Enter current password for root (enter for none): 
//输入 root 用户的当前密码（如果没有密码，请直接按回车）：

OK, successfully used password, moving on...
//OK，成功使用密码，继续执行...

Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation.
//设置 root 密码或使用 unix_socket 可以确保未经适当授权的人无法登录 MariaDB 的 root 用户。

You already have your root account protected, so you can safely answer 'n'.
//您的 root 账户已经受到保护，因此您可以安全地回答 'n'。
Switch to unix_socket authentication [Y/n] n
//切换到 unix_socket 认证 [Y/n] n

 ... skipping.
//... 跳过。

You already have your root account protected, so you can safely answer 'n'.
//您的 root 账户已经受到保护，因此您可以安全地回答 'n'。
Change the root password? [Y/n] n
//更改 root 密码？[Y/n] n

 ... skipping.
//... 跳过。

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.
//默认情况下，MariaDB 安装会创建一个匿名用户，允许任何人无需创建用户账户即可登录 MariaDB。这仅用于测试目的，以使安装过程更加顺利。在进入生产环境之前，您应该删除这些匿名用户。

Remove anonymous users? [Y/n] 
//删除匿名用户？[Y/n]
 ... Success!
//... 成功！

Normally, root should only be allowed to connect from 'localhost'.  This ensures that someone cannot guess at the root password from the network.
//通常情况下，root 用户应仅允许从 localhost 连接。这可以确保他人无法通过网络猜测 root 密码。

Disallow root login remotely? [Y/n] 
//禁止 root 用户远程登录？[Y/n]
 ... Success!
//... 成功！

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.
//默认情况下，MariaDB 附带一个名为 test 的数据库，任何人都可以访问。这也仅用于测试目的，在进入生产环境之前应将其删除。

Remove test database and access to it? [Y/n] 
//删除测试数据库并取消对其的访问权限？[Y/n]
 - Dropping test database...
//正在删除测试数据库...
 ... Success!
//... 成功！
 - Removing privileges on test database...
//正在移除测试数据库的权限...
 ... Success!
//... 成功！

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
//重新加载权限表将确保到目前为止所做的所有更改立即生效。

Reload privilege tables now? [Y/n] 
//现在重新加载权限表吗？[Y/n]
 ... Success!
//... 成功！

Cleaning up...
//清理中...

All done!  If you've completed all of the above steps, your MariaDB installation should now be secure.
//全部完成！如果您已完成上述所有步骤，您的 MariaDB 安装现在应该是安全的。

Thanks for using MariaDB!
//感谢使用 MariaDB！" style="color:#f6f6f4;display:none" aria-label="复制" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F6F6F4">NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!</span></span>
<span class="line"><span style="color: #7B7F8B">//建议在生产环境中使用的所有 MariaDB 服务器上运行此脚本的所有部分！请仔细阅读每一步！</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">In order to log into MariaDB to secure it, we&#39;ll need the current password for the root user. If you&#39;ve just installed MariaDB, and haven&#39;t set the root password yet, you should just press enter here.</span></span>
<span class="line"><span style="color: #7B7F8B">//为了登录 MariaDB 并进行安全设置，我们需要 root 用户的当前密码。如果您刚刚安装了 MariaDB，并且尚未设置 root 密码，您可以直接在这里按回车键。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Enter current password for root (enter for none): </span></span>
<span class="line"><span style="color: #7B7F8B">//输入 root 用户的当前密码（如果没有密码，请直接按回车）：</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">OK, successfully used password, moving on...</span></span>
<span class="line"><span style="color: #7B7F8B">//OK，成功使用密码，继续执行...</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation.</span></span>
<span class="line"><span style="color: #7B7F8B">//设置 root 密码或使用 unix_socket 可以确保未经适当授权的人无法登录 MariaDB 的 root 用户。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">You already have your root account protected, so you can safely answer &#39;n&#39;.</span></span>
<span class="line"><span style="color: #7B7F8B">//您的 root 账户已经受到保护，因此您可以安全地回答 &#39;n&#39;。</span></span>
<span class="line"><span style="color: #F6F6F4">Switch to unix_socket authentication [</span><span style="color: #EE6666; font-style: italic; text-decoration: underline">Y/n</span><span style="color: #F6F6F4">] n</span></span>
<span class="line"><span style="color: #7B7F8B">//切换到 unix_socket 认证 [Y/n] n</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4"> ... skipping.</span></span>
<span class="line"><span style="color: #7B7F8B">//... 跳过。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">You already have your root account protected, so you can safely answer &#39;n&#39;.</span></span>
<span class="line"><span style="color: #7B7F8B">//您的 root 账户已经受到保护，因此您可以安全地回答 &#39;n&#39;。</span></span>
<span class="line"><span style="color: #F6F6F4">Change the root password? [</span><span style="color: #EE6666; font-style: italic; text-decoration: underline">Y/n</span><span style="color: #F6F6F4">] n</span></span>
<span class="line"><span style="color: #7B7F8B">//更改 root 密码？[Y/n] n</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4"> ... skipping.</span></span>
<span class="line"><span style="color: #7B7F8B">//... 跳过。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">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</span></span>
<span class="line"><span style="color: #F6F6F4">production environment.</span></span>
<span class="line"><span style="color: #7B7F8B">//默认情况下，MariaDB 安装会创建一个匿名用户，允许任何人无需创建用户账户即可登录 MariaDB。这仅用于测试目的，以使安装过程更加顺利。在进入生产环境之前，您应该删除这些匿名用户。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Remove anonymous users? [</span><span style="color: #EE6666; font-style: italic; text-decoration: underline">Y/n</span><span style="color: #F6F6F4">] </span></span>
<span class="line"><span style="color: #7B7F8B">//删除匿名用户？[Y/n]</span></span>
<span class="line"><span style="color: #F6F6F4"> ... Success!</span></span>
<span class="line"><span style="color: #7B7F8B">//... 成功！</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Normally, root should only be allowed to connect from &#39;localhost&#39;.  This ensures that someone cannot guess at the root password from the network.</span></span>
<span class="line"><span style="color: #7B7F8B">//通常情况下，root 用户应仅允许从 localhost 连接。这可以确保他人无法通过网络猜测 root 密码。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Disallow root login remotely? [</span><span style="color: #EE6666; font-style: italic; text-decoration: underline">Y/n</span><span style="color: #F6F6F4">] </span></span>
<span class="line"><span style="color: #7B7F8B">//禁止 root 用户远程登录？[Y/n]</span></span>
<span class="line"><span style="color: #F6F6F4"> ... Success!</span></span>
<span class="line"><span style="color: #7B7F8B">//... 成功！</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">By default, MariaDB comes with a database named &#39;test&#39; that anyone can access.  This is also intended only for testing, and should be removed before moving into a production environment.</span></span>
<span class="line"><span style="color: #7B7F8B">//默认情况下，MariaDB 附带一个名为 test 的数据库，任何人都可以访问。这也仅用于测试目的，在进入生产环境之前应将其删除。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Remove test database and access to it? [</span><span style="color: #EE6666; font-style: italic; text-decoration: underline">Y/n</span><span style="color: #F6F6F4">] </span></span>
<span class="line"><span style="color: #7B7F8B">//删除测试数据库并取消对其的访问权限？[Y/n]</span></span>
<span class="line"><span style="color: #F6F6F4"> - Dropping test database...</span></span>
<span class="line"><span style="color: #7B7F8B">//正在删除测试数据库...</span></span>
<span class="line"><span style="color: #F6F6F4"> ... Success!</span></span>
<span class="line"><span style="color: #7B7F8B">//... 成功！</span></span>
<span class="line"><span style="color: #F6F6F4"> - Removing privileges on test database...</span></span>
<span class="line"><span style="color: #7B7F8B">//正在移除测试数据库的权限...</span></span>
<span class="line"><span style="color: #F6F6F4"> ... Success!</span></span>
<span class="line"><span style="color: #7B7F8B">//... 成功！</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Reloading the privilege tables will ensure that all changes made so far will take effect immediately.</span></span>
<span class="line"><span style="color: #7B7F8B">//重新加载权限表将确保到目前为止所做的所有更改立即生效。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Reload privilege tables now? [</span><span style="color: #EE6666; font-style: italic; text-decoration: underline">Y/n</span><span style="color: #F6F6F4">] </span></span>
<span class="line"><span style="color: #7B7F8B">//现在重新加载权限表吗？[Y/n]</span></span>
<span class="line"><span style="color: #F6F6F4"> ... Success!</span></span>
<span class="line"><span style="color: #7B7F8B">//... 成功！</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Cleaning up...</span></span>
<span class="line"><span style="color: #7B7F8B">//清理中...</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">All done!  If you&#39;ve completed all of the above steps, your MariaDB installation should now be secure.</span></span>
<span class="line"><span style="color: #7B7F8B">//全部完成！如果您已完成上述所有步骤，您的 MariaDB 安装现在应该是安全的。</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">Thanks for using MariaDB!</span></span>
<span class="line"><span style="color: #7B7F8B">//感谢使用 MariaDB！</span></span></code></pre></div>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
