<h2>How to Install and Secure MariaDB on Linux</h2>
<p>MariaDB is a popular open-source database system and a drop-in replacement for MySQL. This guide walks you through installing and securing it on a Linux server.</p>

<h3>1. Update Your System</h3>
<pre><code>sudo apt update && sudo apt upgrade</code></pre>

<h3>2. Install MariaDB</h3>
<pre><code>sudo apt install mariadb-server</code></pre>

<h3>3. Start and Enable the Service</h3>
<pre><code>sudo systemctl start mariadb
sudo systemctl enable mariadb</code></pre>

<h3>4. Run the Secure Installation Script</h3>
<pre><code>sudo mysql_secure_installation</code></pre>
<p>During the prompt:</p>
<ul>
<li>Set a root password (if not already set)</li>
<li>Remove anonymous users</li>
<li>Disallow remote root login</li>
<li>Remove test databases</li>
<li>Reload privileges</li>
</ul>

<h3>5. Test the Installation</h3>
<pre><code>sudo mysql -u root -p</code></pre>
<p>Enter the password you just created. You should now be inside the MariaDB shell.</p>

<h3>6. (Optional) Create a New User and Database</h3>
<pre><code>
CREATE DATABASE exampledb;
CREATE USER 'exampleuser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON exampledb.* TO 'exampleuser'@'localhost';
FLUSH PRIVILEGES;
</code></pre>

<h3>Summary</h3>
<p>MariaDB is now installed and secured. You’ve taken important steps to harden the database server and can now begin using it in your projects or applications.</p>

War diese Antwort hilfreich? 0 Benutzer fanden dies hilfreich (0 Stimmen)