このチュートリアルでは、MySQLをAlmaLinux 8にインストールする方法を示します。知らなかった人のために、MySQLは、多数のユーザーアクセスを提供するサーバーとして実行されるリレーショナルデータベース管理システム(RDBMS)です。データベース。 MySQLのソースコードは元々Oracleによって開発されたものであるため、無料で入手できます。 MySQLはCおよびC ++で記述されており、すべての主要なオペレーティングシステムと互換性があります。 MySQLはさまざまなアプリケーションに使用できますが、最も一般的にはWebサーバーで使用されます。
この記事は、少なくともLinuxの基本的な知識があり、シェルの使用方法を知っていること、そして最も重要なこととして、自分のVPSでサイトをホストしていることを前提としています。 インストールは非常に簡単で、rootアカウントで実行していることを前提としています。そうでない場合は、 ‘を追加する必要があります。sudo
‘root権限を取得するコマンドに。 AlmaLinux8にMySQLデータベースを段階的にインストールする方法を紹介します。
MySQLをAlmaLinux8にインストールします
ステップ1.まず、システムが最新であることを確認することから始めましょう。
sudo dnf update sudo dnf install epel-release
ステップ2.AlmaLinux8にMySQLをインストールします。
次に、次のコマンドを実行してMySQLをインストールします。
sudo dnf install mysql-server mysql
正常にインストールされたら、以下を使用してシステムの起動時に起動できるようにします。
sudo systemctl restart mysqld sudo systemctl status mysqld sudo systemctl enable mysqld
デフォルトでは、MariaDBは強化されていません。 を使用してMariaDBを保護できます mysql_secure_installation
脚本。 ルートパスワードを設定し、匿名ユーザーを削除し、リモートルートログインを禁止し、テストデータベースと安全なMariaDBへのアクセスを削除する各手順を注意深く読み、以下を実行する必要があります。
mysql_secure_installation
出力:
[[email protected] ~]# mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: Please set the password for root here. New password: Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL 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? (Press y|Y for Yes, any other key for No) : y - 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? (Press y|Y for Yes, any other key for No) : y Success. All done!
MariaDBにログインするには、次のコマンドを使用します(MariaDBデータベースにログインするために使用するコマンドと同じであることに注意してください)。
mysql -u root -p
実稼働サーバーでMySQLを実行するときに最も重要なことの1つは、そのパフォーマンスを最大限に活用することです。 初心者でMySQLサーバーの調整方法がわからない場合は、MySQLTunerというプログラムから始めることができます。 サーバーを分析し、全体的なパフォーマンスを向上させるためにMySQLを調整するのに役立ちます。
おめでとう! MySQLが正常にインストールされました。 このチュートリアルを使用して、AlmaLinux8システムにMySQLサーバーをインストールしていただきありがとうございます。 追加のヘルプまたは有用な情報については、チェックすることをお勧めします MySQLの公式ウェブサイト。