数据库


在CentOS 8上dnf安装MariaDB 10.4

<h3>1.安装MariaDB 10.4 yum存储库</h3> <p>默认的CentOS 8AppStream存储库包含MariadDB 10.3 (截至撰写本文时),要安装MariaDB 10.4,你需要安装它YUM存储库。</p> <pre><code class="language-bash">cat &lt;&lt; EOF &gt; /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB-10.4 baseurl=http://yum.mariadb.org/10.4/centos8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF</code></pre> <h3>2.安装MariaDB YUM存储库签名密钥。</h3> <pre><code class="language-bash">rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB</code></pre> <h3>3.更新你的系统</h3> <pre><code class="language-bash">dnf -y update</code></pre> <p>安装MariaDB 10.4</p> <h3>4.禁用提供MariaDB 10 3软件包的AppStream存储库</h3> <p>要从上面创建的存储库安装MariaDB 10.4,你需要禁用提供MariaDB 10 3软件包的AppStream存储库。</p> <pre><code class="language-bash">dnf --disablerepo=AppStream install MariaDB-server MariaDB-client</code></pre> <h3>5.报错处理</h3> <p>如果,由于某些原因,在安装过程中你得到了错误;</p> <pre><code class="language-bash">Error: Problem: package MariaDB-server-10.4.11-1.el8.x86_64 requires galera-4, but none of the providers can be installed - cannot install the best candidate for the job - nothing provides libboost_program_options.so.1.66.0()(64bit) needed by galera-4-26.4.3-1.rhel8.0.el8.x86_64 (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)</code></pre> <p>解决办法: 运行上面提到的galera-4软件包。</p> <pre><code class="language-bash">dnf install galera-4</code></pre> <p>在安装过程中,将创建两个权限MariaDB 10.4用户帐户。 [email protected][email protected] 运行MariaDB</p> <h3>6.启动MariaDB</h3> <pre><code class="language-bash">systemctl start mariadb</code></pre> <h3>7.使MariaDB在系统引导上运行;</h3> <pre><code class="language-bash">systemctl enable mariadb</code></pre> <h3>8.检查MariaDB的状态;</h3> <pre><code class="language-bash">systemctl status mariadb</code></pre> <h3>9.验证MariaDB已安装的版本。</h3> <pre><code class="language-bash">mysql -v</code></pre> <h3>10.保护MariaDB</h3> <p>MariaDB附带了一个默认的安全脚本mysql_secure_installation,用于提高MariaDB的安全性, 为root帐户设置密码,删除可从本地主机外部访问的root帐户,删除匿名用户帐户,删除测试数据库,默认情况下,匿名用户可以访问该数据库, 运行下面的命令启动脚本。</p> <pre><code class="language-bash">mysql_secure_installation</code></pre> <h3>11.MariaDB 10.4身份验证</h3> <p>MariaDB 10.4 Authentication,如上所述,在安装MariaDB 10 4的过程中会创建两个安全帐户,[email protected] 当以本地用户的身份从本地主机建立到MariaDB的连接时,Unix_socket插件可以工作,你只需登录即可运行命令(以root或sudo身份);</p> <pre><code class="language-bash">mysql mysql -u root</code></pre> <p>mysql_native_password插件用作unix_socket插件的故障转移,但是,该帐户的密码无效,要启用密码身份验证,你需要如上所述以root用户身份登录MariaDB并设置密码。</p> <pre><code class="language-bash">mysql set password = password("[email protected]");</code></pre> <p>这将重新启用MariaDB密码身份验证。</p> <p>将本机密码身份验证方法设置为默认 如果需要将unix_socket 插件身份验证更改为msqyl_native_password。</p> <pre><code class="language-bash">mysql ALTER USER [email protected] IDENTIFIED VIA mysql_native_password USING PASSWORD("MyPQQSSword");</code></pre> <p>下次尝试登录而不指定密码时,登录将失败。 sudo mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)</p> <p>来源: 在CentOS 8上安装MariaDB 10.4 <a href="https://www.kutu66.com/CentOS/article_184597">https://www.kutu66.com/CentOS/article_184597</a> 国内源: <a href="https://www.solves.com.cn/it/sjk/bk/2019-10-30/6954.html">https://www.solves.com.cn/it/sjk/bk/2019-10-30/6954.html</a></p>

页面列表

ITEM_HTML