MochiuWiki : SUSE, EC, PCB
案内
メインページ
最近の更新
おまかせ表示
MediaWiki についてのヘルプ
ツール
リンク元
関連ページの更新状況
特別ページ
ページ情報
We ask for
Donations
検索
個人用ツール
ログイン
Toggle dark mode
名前空間
ページ
議論
表示
閲覧
ソースを閲覧
履歴を表示
インストール - MariaDBのソースを表示
提供: MochiuWiki : SUSE, EC, PCB
←
インストール - MariaDB
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループのいずれかに属する利用者のみが実行できます:
管理者
、new-group。
このページのソースの閲覧やコピーができます。
== 概要 == データベースサーバは、サーバ上のデータベースをクライアントから操作できるようにするためのサーバである。<br> ここでは、RDBのデータベースサーバであるMariaDBを使用する。<br> <br><br> == MariaDBのインストール == MariaDBをインストールするため、以下のコマンドを実行する。<br> sudo zypper install mariadb mariadb-tools <br> 正常にインストールされているか確認する。<br> mariadb –version <br> 次に、MariaDBの設定ファイル(my.cnfファイル)を開いて、[mysqld]セクションに以下の設定を追記する。<br> sudo vi /etc/my.cnf [mysqld] character-set-server=utf8 # 追記 <br> 最後に、MariaDBの起動の設定を行う。<br> sudo systemctl enable mariadb sudo systemctl start mariadb <br><br> == MariaDBの設定 == MariaDBのセキュリティを向上させるため、以下のコマンドを実行する。<br> sudo mysql_secure_installation <br> 下記の説明が表示されるので、翻訳付きで説明する。<br> NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! 注意: 実運用環境のすべての MariaDB サーバにおいて、当スクリプトのすべての処理を実行することが推奨されます! 各手順をよくお読みください! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. MariaDBにログインしてそれを安全にするには、rootユーザの現在のパスワードが必要です。 MariaDBをインストールした直後でrootパスワードをまだセットしていない場合、パスワードは空白であるため、そのままEnterキーを押してください。 Enter current password for root (enter for none): root の現在のパスワードを入力してください(未設定ならEnter) OK, successfully used password, moving on... パスワード認証に成功しました、処理を続行しています... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. root パスワードを設定することで、適切な認証なしではMariaDBのrootユーザにログインできなくなります。 You already have a root password set, so you can safely answer 'n'. すでにrootパスワードがセットされているので、「n」と回答しても安全です。 Change the root password? [Y/n] n root パスワードを変更しますか? ... skipping. ... スキップ By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB 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. 既定で、MariaDBのインストール作業においては匿名ユーザを利用することができ、ユーザアカウントの作成なしで誰でもログインすることが できます。これは、インストールを若干スムーズに行うために存在し、テストのみで利用することが想定されています。 これらは、実運用環境に移行する前に削除する必要があります。 Remove anonymous users? [Y/n] 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. 通常、root ログインはlocalhostからの接続のみで許可されるべきです。それにより、ネットワークからrootパスワードを推測できないようになります。 Disallow root login remotely? [Y/n] y リモートからのrootログインを禁止しますか? ... Success! ... 成功しました! By default, MariaDB 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. 既定で、MariaDBには、だれでもアクセス可能なtestという名前のデータベースが付属しています。 これもテストのみで利用されることが想定されており、実運用環境に移行する前に削除する必要があります。 Remove test database and access to it? [Y/n] y testデータベースとそのデータベースへのアクセスを削除しますか? - Dropping test database... - testデータベースを削除しています... ... Success! ... 成功しました! - Removing privileges on test database... - testデータベースに対する権限を削除しています... ... Success! ... 成功しました! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. 権限テーブルを再読み込みすると、ここまでのすべての変更をすぐに反映させることができます。 Reload privilege tables now? [Y/n] y 今すぐ権限テーブルを再読み込みしますか? ... Success! ... 成功しました! Cleaning up... クリーンアップしています... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. 完了しました! 以上のすべての処理を実行していれば、安全にMariaDBをインストールできているはずです。 Thanks for using MariaDB! MariaDBのご利用ありがとうございます! == MariaDBのユーザ登録 == MariaDBにrootユーザで接続するため、以下のコマンドを実行する。<br> mysql -u root -p <br> 上記で設定したMariaDBのrootパスワードを入力する。<br> Enter password: <br> ユーザ情報の一覧表示をするには、以下のクエリを発行する。<br> select user, host, password from mysql.user; <br> データベースの一覧表示をするには、以下のクエリを発行する。<br> show databases; <br> まず、全てのデータベースへの全てのアクセス権限を持った、新規ユーザsuseを登録する。<br> grant all privileges on *.* to suse@localhost identified by 'パスワード'; <br> suseユーザの登録が成功したか確認する。<br> select user from mysql.user where user='centos'; <br> suseユーザの登録をMariaDBサーバへ反映する。<br> flush privileges; <br> MariaDBからログアウトする。<br> exit <br><br> == MariaDBにおけるデータベースの作成 == suseユーザでMariaDBへログインする。<br> mysql -u centos -p 3ulank8y <br> D_Sampleデータベースを作成する。<br> create database D_Sample; <br> D_Sample用データベースが作成できたか確認する。<br> show databases; <br> D_Sampleデータベースへ接続する。<br> use D_Sample; <br> T_Employeeテーブルを作成する。<br> create table T_Employee(employee_no int, first_name varchar(50), last_name varchar(50)); <br> T_Employeeテーブルが作成できたか確認する。<br> show tables; <br> T_Employeeテーブルにレコードを登録する。<br> insert into T_Employee values(1, '太郎', ‘山田’); <br> MariaDBからログアウトする。<br> exit <br><br> == 登録したユーザの削除 == suseユーザを削除する。<br> delete from mysql.user where user='suse' and host='localhost'; <br> suseユーザが削除されたか確認する。<br> select user from mysql.user where user='suse'; <br> suseユーザの削除をMariaDBサーバへ反映する。<br> flush privileges; <br> MariaDBからログアウトする。<br> exit <br><br> == ユーザの権限を削除 == suseユーザから全てのデータベースへのアクセス権限を剥奪する。<br> revoke all privileges on *.* from suse@localhost; <br><br> __FORCETOC__ [[カテゴリ:SUSE]]
インストール - MariaDB
に戻る。
案内
メインページ
最近の更新
おまかせ表示
MediaWiki についてのヘルプ
ツール
リンク元
関連ページの更新状況
特別ページ
ページ情報
We ask for
Donations
Collapse