GNU/Linux >> Linux の 問題 >  >> Fedora

MySQLをFedora35にインストールする方法

このチュートリアルでは、MySQLをFedora 35にインストールする方法を示します。知らなかった人のために、MySQLはオープンソースのリレーショナルデータベース管理システムです。人気のあるリレーショナル管理システム。MySQLには次の商用製品が付属しています。

  • MySQLStandardEdition。
  • MySQLEnterpriseEdition。
  • MySQL Cluster CarrierGradeEdition。

これらのエディションにはすべて値札が付いており、ほとんどの場合商用利用に適しています。このガイドのGPLライセンスの下で無料で使用できるMySQLCommunityEditionを使用します。

この記事は、少なくともLinuxの基本的な知識があり、シェルの使用方法を知っていること、そして最も重要なこととして、サイトを独自のVPSでホストしていることを前提としています。インストールは非常に簡単で、ルートアカウントで実行されていますが、そうでない場合は、'sudoを追加する必要があります。 ‘ルート権限を取得するコマンドに。 Fedora35にMySQLサーバーを段階的にインストールする方法を紹介します。

前提条件

  • 次のオペレーティングシステムのいずれかを実行しているサーバー:Fedora35またはFedora34。
  • 潜在的な問題を防ぐために、OSの新規インストールを使用することをお勧めします
  • non-root sudo user またはroot userへのアクセス 。 non-root sudo userとして行動することをお勧めします ただし、ルートとして機能するときに注意しないと、システムに害を及ぼす可能性があるためです。

Fedora35にMySQLをインストールする

手順1.続行する前に、Fedoraオペレーティングシステムを更新して、既存のすべてのパッケージが最新であることを確認します。次のコマンドを使用して、サーバーパッケージを更新します。

sudo dnf upgrade
sudo dnf update

ステップ2.Fedora35にMySQLをインストールします。

デフォルトでは、MySQLはFedora 35ベースリポジトリで利用できます。次に、次のコマンドでMySQLサーバーをインストールできます。

sudo dnf install community-mysql-server

インストールが完了したら、MySQLサーバーを起動して動作を開始する必要があります。これを行うには、以下のコマンドを使用します。

sudo systemctl start mysqld
sudo systemctl enable mysqld
sudo systemctl status mysqld

次のコマンドでMySQLのバージョンを確認しましょう:

mysql -V

ステップ3.MySQLのインストールを保護します。

デフォルトでは、MySQLは強化されていません。mysql_secure_installationを使用してMySQLを保護できます。 脚本。ルートパスワードを設定し、匿名ユーザーを削除し、リモートルートログインを禁止し、テストデータベースと安全なMySQLへのアクセスを削除する各手順を注意深く読んでください。

mysql_secure_installation

出力:

Securing the MySQL server deployment.

Enter password for user root: 

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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.

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!

すべて完了しました。これで、コマンドラインを使用してMySQLサーバーに接続できます。次のコマンドは、ローカルホストで実行されているMySQLをrootユーザーとして接続します。

>
mysql -u root -p

手順4.ファイアウォールを構成します。

リモート接続を許可し、ファイアウォールのポート3306を許可します:

sudo firewall-cmd --add-service=mysql --permanent
sudo firewall-cmd --reload

おめでとうございます!MySQLが正常にインストールされました。Fedora35システムにMySQLデータベースをインストールするためにこのチュートリアルを使用していただきありがとうございます。追加のヘルプまたは有用な情報については、MySQLの公式Webサイトを確認することをお勧めします。


Fedora
  1. MySQL8.0をFedora35/Fedora34にインストールする方法

  2. CentOS 7.xにMySQLをインストールする方法は?

  3. Ubuntu 22.04 に MySQL をインストールする方法

  1. AmazonLinuxにMySQL5.7をインストールする方法

  2. Ubuntu18.04にMySQLをインストールする方法

  3. Ubuntu20.04にMySQLデータベースをインストールする方法

  1. Ubuntu20.04にMySQLをインストールする方法

  2. MySQLをDebian9にインストールする方法

  3. MySQLをDebian10Linuxにインストールする方法