ナチュログ管理画面 キャンプ キャンプ 関東 アウトドア&フィッシングナチュラムアウトドア用品お買い得情報
ブログ作成はコチラ
あなたもナチュログでアウトドア生活を綴ってみませんか?
ブログランキング・にほんブログ村へ
にほんブログ村
1)MySQL5.7


何かのバージョンが入っているとまずいのでクリーンに削除しておく

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean








#####Add MySQL APT Repository in Ubuntu
リポジトリの追加

$ sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb

$ sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb


「Ubuntu Bionic」を選択
「MySQL 8.0」を選択して、「First option」をクリック
「MySQL 5.7 server」が選択できるのでクリック
Confirm that showing MySQL 5.7 on First option and Click on OK.


######Update MySQL Repository
導入したリポジトリをアップデート
$ sudo apt-get update
$ sudo apt-cache policy mysql-server

Search MySQL 5.7 package using MySQL apt cache and select 5.7.30-1ubuntu18.04 to install

以下画面出力結果

mysql-server:

Installed: (none)

Candidate: 8.0.20-0ubuntu0.20.04.1

Version table:

8.0.20-0ubuntu0.20.04.1 500

500 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages

500 http://in.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages

8.0.19-0ubuntu5 500

500 http://in.archive.ubuntu.com/ubuntu focal/main amd64 Packages

5.7.31-1ubuntu18.04 500

500 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 Packages


Now install MySQL client 5.7.31 as output shown above

$ sudo apt install -f mysql-community-server=5.7.31-1ubuntu18.04
$ sudo apt install -f mysql-client=5.7.31-1ubuntu18.04

Installation process will prompt default password for root user and again same password.

Install mysql-server=5.7.31 package also


######Secure MySQL Installation

MySQL Server comes with a script mysql_secure_installation this can do multiple security related operations,

Run the below script on command prompt, asks below options.

$ mysql_secure_installation

Enter password for user root:

VALIDATE PASSWORD PLUGIN 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 plugin?

Press y|Y for Yes, any other key for No: n

There are three levels of password validation policy:

LOW Length >= 4
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Using existing password for root.

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

... skipping.
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!


######Login to MySQL その他コマンド類

$ mysql -u root -p

パスワード強化プラグインを入れてしまった場合、コマンドでルールを弱くしてから作業
mysql> SET GLOBAL validate_password_policy=LOW;
mysql> SET GLOBAL validate_password_length=4;

mysql> select host, user from mysql.user;
$ sudo mysql -u root -p
$ sudo systemctl stop mysql
$ sudo systemctl start mysql
$ sudo systemctl restart mysql
$ sudo systemctl status mysql
$ sudo systemctl disable mysql
$ sudo systemctl enable mysql

設定確認
#(文字コード確認)
mysql> show variables like '%char%';

#(照合順序確認)
mysql> show variables like '%collation%';

#(パスワードポリシー)
mysql> show variables like '%validate_password%';\q


(パスワード有効期限)
mysql> select @@default_password_lifetime;
”0”になっていれば良い

削除
sudo apt-get remove --purge mysql-server* mysql-common
sudo apt-get autoremove --purge
sudo rm -r /etc/mysql
sudo rm -r /var/lib/mysql


現在作成済みのユーザーの一覧
mysql> select user, host from mysql.user;
mysql> drop user ユーザー名@ホスト名;

例えば drop user shika@localhost;



######MySQL-workbench-communityのインストール

ソフトウエアから検索してインストールすると接続できない

HPからファイル「mysql-workbench-community_8.0.21-1ubuntu20.04_amd64.deb」を
ダウンロードしてインストール

cd home/kondou/Downloads
sudo dpkg -i mysql-workbench-community*.deb


今回は普通に「root」で接続できる。いつからそうなったのか???



また、普通にソフトウエアから検索してインストール可能だが---------やってみると

接続できない。

MyAQL5.7のいつかの時点で、root ではデータベースにアクセスできないので接続専用ユーザー「work」を作り「PW=work」全権を与えてみる
CREATE USER 'ユーザ名'@'ホスト名' IDENTIFIED BY 'パスワード';
DROP USER 'ユーザ名'@'ホスト名';

いわゆる何でもできる管理者用ユーザ
GRANT ALL ON *.* TO adminuser@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;


接続ユーザーの作成

MySQLにログイン後、下記コマンドを実行します。


mysql> create user work@'%' identified by 'work';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'work'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> select host, user from mysql.user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | work |
| localhost | debian-sys-maint |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+------------------+
5 rows in set (0.00 sec)

「Local instance 3306」を右クリックして、「Edit Connection...」をクリックします。
Connectionタブの中のParametersタブで、Usernameを先程設定した「work」と入力し、「Store in Keychain...」をクリックします。
パスワードに先程設定した「work」をパスワードとして入力して、OKをクリックします。
「Test Connection」をクリックすると、接続に成功したことが表示されます。その後、Closeをクリックします。

以前は、これでアクセスできるようになったが、今回は普通に「root」で接続できるので、不要ですね。この手の細かな仕様変更は戸惑いますね。







このブログの人気記事
オンライン資格確認顛末記 (その一;素のWin10-64 失敗編)
オンライン資格確認顛末記 (その一;素のWin10-64 失敗編)

ubuntu20でSystemBack
ubuntu20でSystemBack

同じカテゴリー(パソコン)の記事画像
RHEL8.4インストール(1)
オンライン資格確認顛末記 (その一;素のWin10-64 失敗編)
dem4chee-arc-light-5 インストールメモ
NASのPACSアプリが動いた(半分だけ)
同じカテゴリー(パソコン)の記事
 Windows11+WSL2:Ubuntu+Docker+dcm4chee-arch-light (2022-08-25 07:19)
 ubuntu22+Postgres(基本設定も含む)+Non-Docker-New-PACS(1) (2022-08-22 04:38)
 Alma8.6になったらMySQLのインストールが困った (2022-08-21 05:51)
 ubuntu22.04 追加セッティング (2022-08-12 02:56)
 ubuntu22.04とMySQL (2022-05-28 05:06)
 Ubuntu20.04+Docker+dcm4che-arch-light-5 (2021-11-24 03:22)

※このブログではブログの持ち主が承認した後、コメントが反映される設定です。
上の画像に書かれている文字を入力して下さい
 
<ご注意>
書き込まれた内容は公開され、ブログの持ち主だけが削除できます。


削除
ubuntu20.04にMySQL5.7とMySQLworkbenchをインストールする
    コメント(0)