アンドロイド

Debian 10 Linuxにmysqlをインストールする方法

FTL Advanced Edition Gameplay On Linux

FTL Advanced Edition Gameplay On Linux

目次:

Anonim

MySQLは、世界で最も人気のあるオープンソースリレーショナルデータベース管理システムであり、デフォルトのDebianリポジトリにはありません。 MariaDBはDebian 10のデフォルトのデータベースシステムです。

このチュートリアルでは、MySQL AptリポジトリからDebian 10にMySQLをインストールして保護する方法について説明します。

MySQLリポジトリの構成

MySQL APTリポジトリをシステムに追加するには、リポジトリダウンロードページに移動し、次のwgetコマンドを使用して最新リリースパッケージをダウンロードします。

wget

ダウンロードが完了したら、sudo権限を持つユーザーとしてリリースパッケージをインストールします。

sudo apt install./mysql-apt-config_0.8.13-1_all.deb

インストールするMySQLバージョンを選択できる設定メニューが表示されます。

インストールが完了すると、MySQLサービスが自動的に開始されます。次のように入力して確認できます。

sudo systemctl status mysql

● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en Active: active (running) since Fri 2019-07-26 13:23:25 PDT; 37s ago…

MySQLの保護

mysql_secure_installation コマンドを実行して、rootパスワードを設定し、MySQLインストールのセキュリティを改善します。

sudo 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:

MySQLユーザーのパスワードの強度をテストするために使用される VALIDATE PASSWORD PLUGIN を設定するよう求められます。 パスワード検証ポリシーには、低、中、強力の3つのレベルがあります。 パスワード検証プラグインを設定しない場合は、 ENTER 押し ENTER

Please set the password for root here. New password: Re-enter new password:

次のプロンプトで、MySQL rootユーザーのパスワードを設定するよう求められます。

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!

rootパスワードを設定すると、スクリプトは匿名ユーザーの削除、rootユーザーによるローカルマシンへのアクセスの制限、テストデータベースの削除を要求します。 すべての質問に「Y」(はい)と答える必要があります。

MySQLサーバーへの接続

ターミナルを介してMySQLとやり取りするには、MySQLサーバーパッケージの依存関係としてインストールされている mysql クライアントを使用します。

デフォルトの認証方法を選択して、rootユーザータイプとしてMySQLサーバーにログインした場合:

sudo mysql

それ以外の場合、ログインタイプに従来の認証方法を選択した場合:

mysql -u root -p

mysql_secure_installation スクリプトの実行時に以前に設定したルートパスワードの入力を mysql_secure_installation られます。 パスワードを入力すると、次のようにMySQLシェルが表示されます。

Welcome to the MySQL monitor. Commands end with; or \g. Your MySQL connection id is 10 Server version: 8.0.17 MySQL Community Server - GPL…

結論

このチュートリアルでは、Debian 10サーバーにMySQLサーバーをインストールして保護する方法を学びました。 また、MySQLシェルに接続する方法も示しました。

アプリケーションに特定の要件がない場合は、Debian 10のデフォルトのデータベースシステムであるMariaDBを使用する必要があります。

mysql debian