- 投稿日:2020-12-18T23:47:23+09:00
AWS の EC2 Graviton2 インスタンスに MySQL をインストールしてみた(だけ)
これは MySQL Advent Calendar 2020 17 日目のエントリです(後から穴埋め)。
AWS では今年、EC2・RDS に 64-bit Arm ベースの Graviton2 プロセッサを採用したインスタンスを立てられるようになりましたので、EC2 の r6g.large インスタンス(2vCPU・メモリ 16GiB)に MySQL Server 8.0.22 をインストールしてみました。
※本当にインストールしただけです(続きは後日)。
EC2 インスタンス起動
まずは 64-bit Arm 向けの CentOS 8.3(あえて Stream ではない)を選んで、
r6g.large インスタンスを選択して…
ストレージは gp3 を選んでインスタンスを立ててみました。
MySQL Community Server 8.0.22 インストール
x86_64 系プロセッサを使う場合とほぼ同様に MySQL Community Server 8.0.22 をインストールしていきます。
※適宜、言語・ロケールなどの設定を行ってください(ここでは省略)。
まずはwgetを入れる$ sudo dnf install wget Last metadata expiration check: 0:01:08 ago on Fri 18 Dec 2020 12:56:37 PM UTC. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: wget aarch64 1.19.5-10.el8 appstream 716 k Transaction Summary ================================================================================ Install 1 Package Total download size: 716 k Installed size: 2.8 M Is this ok [y/N]: y Downloading Packages: wget-1.19.5-10.el8.aarch64.rpm 1.0 MB/s | 716 kB 00:00 -------------------------------------------------------------------------------- Total 608 kB/s | 716 kB 00:01 warning: /var/cache/dnf/appstream-ad81255f8cddaa99/packages/wget-1.19.5-10.el8.aarch64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY CentOS Linux 8 - AppStream 1.6 MB/s | 1.6 kB 00:00 Importing GPG key 0x8483C65D: Userid : "CentOS (CentOS Official Signing Key) <security@centos.org>" Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D From : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial Is this ok [y/N]: y Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : wget-1.19.5-10.el8.aarch64 1/1 Running scriptlet: wget-1.19.5-10.el8.aarch64 1/1 Verifying : wget-1.19.5-10.el8.aarch64 1/1 Installed: wget-1.19.5-10.el8.aarch64 Complete!MySQLのリポジトリを追加$ wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm --2020-12-18 12:57:54-- https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11 Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm [following] --2020-12-18 12:57:55-- https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm Resolving repo.mysql.com (repo.mysql.com)... 23.45.57.22 Connecting to repo.mysql.com (repo.mysql.com)|23.45.57.22|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 30388 (30K) [application/x-redhat-package-manager] Saving to: ‘mysql80-community-release-el8-1.noarch.rpm’ mysql80-community-r 100%[===================>] 29.68K --.-KB/s in 0.001s 2020-12-18 12:57:55 (32.6 MB/s) - ‘mysql80-community-release-el8-1.noarch.rpm’ saved [30388/30388] $ sudo dnf localinstall mysql80-community-release-el8-1.noarch.rpm Last metadata expiration check: 0:01:37 ago on Fri 18 Dec 2020 12:56:37 PM UTC. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mysql80-community-release noarch el8-1 @commandline 30 k Transaction Summary ================================================================================ Install 1 Package Total size: 30 k Installed size: 29 k Is this ok [y/N]: y Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : mysql80-community-release-el8-1.noarch 1/1 Verifying : mysql80-community-release-el8-1.noarch 1/1 Installed: mysql80-community-release-el8-1.noarch Complete! $ sudo dnf module disable mysql MySQL 8.0 Community Server 3.0 MB/s | 1.1 MB 00:00 MySQL Connectors Community 127 kB/s | 43 kB 00:00 MySQL Tools Community 246 kB/s | 79 kB 00:00 Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Disabling modules: mysql Transaction Summary ================================================================================ Is this ok [y/N]: y Complete!MySQLサーバをインストール$ sudo dnf install mysql-community-server Last metadata expiration check: 0:00:25 ago on Fri 18 Dec 2020 12:58:39 PM UTC. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mysql-community-server aarch64 8.0.22-1.el8 mysql80-community 60 M Installing dependencies: libaio aarch64 0.3.112-1.el8 baseos 33 k mysql-community-client aarch64 8.0.22-1.el8 mysql80-community 14 M mysql-community-client-plugins aarch64 8.0.22-1.el8 mysql80-community 106 k mysql-community-common aarch64 8.0.22-1.el8 mysql80-community 620 k mysql-community-libs aarch64 8.0.22-1.el8 mysql80-community 1.4 M perl-Carp noarch 1.42-396.el8 baseos 30 k perl-Data-Dumper aarch64 2.167-399.el8 baseos 57 k perl-Digest noarch 1.17-395.el8 appstream 27 k perl-Digest-MD5 aarch64 2.55-396.el8 appstream 37 k perl-Encode aarch64 4:2.97-3.el8 baseos 1.5 M perl-Errno aarch64 1.28-416.el8 baseos 76 k perl-Exporter noarch 5.72-396.el8 baseos 34 k perl-File-Path noarch 2.15-2.el8 baseos 38 k perl-File-Temp noarch 0.230.600-1.el8 baseos 63 k perl-Getopt-Long noarch 1:2.50-4.el8 baseos 63 k perl-HTTP-Tiny noarch 0.074-1.el8 baseos 58 k perl-IO aarch64 1.38-416.el8 baseos 141 k perl-MIME-Base64 aarch64 3.15-396.el8 baseos 31 k perl-Net-SSLeay aarch64 1.88-1.module_el8.3.0+410+ff426aa3 appstream 372 k perl-PathTools aarch64 3.74-1.el8 baseos 90 k perl-Pod-Escapes noarch 1:1.07-395.el8 baseos 20 k perl-Pod-Perldoc noarch 3.28-396.el8 baseos 86 k perl-Pod-Simple noarch 1:3.35-395.el8 baseos 213 k perl-Pod-Usage noarch 4:1.69-395.el8 baseos 34 k perl-Scalar-List-Utils aarch64 3:1.49-2.el8 baseos 67 k perl-Socket aarch64 4:2.027-3.el8 baseos 59 k perl-Storable aarch64 1:3.11-3.el8 baseos 95 k perl-Term-ANSIColor noarch 4.06-396.el8 baseos 46 k perl-Term-Cap noarch 1.17-395.el8 baseos 23 k perl-Text-ParseWords noarch 3.30-395.el8 baseos 18 k perl-Text-Tabs+Wrap noarch 2013.0523-395.el8 baseos 24 k perl-Time-Local noarch 1:1.280-1.el8 baseos 34 k perl-URI noarch 1.73-3.el8 appstream 116 k perl-Unicode-Normalize aarch64 1.25-396.el8 baseos 78 k perl-constant noarch 1.33-396.el8 baseos 25 k perl-interpreter aarch64 4:5.26.3-416.el8 baseos 6.3 M perl-libnet noarch 3.11-3.el8 appstream 121 k perl-libs aarch64 4:5.26.3-416.el8 baseos 1.5 M perl-macros aarch64 4:5.26.3-416.el8 baseos 72 k perl-parent noarch 1:0.237-1.el8 baseos 20 k perl-podlators noarch 4.11-1.el8 baseos 118 k perl-threads aarch64 1:2.21-2.el8 baseos 60 k perl-threads-shared aarch64 1.58-2.el8 baseos 47 k Installing weak dependencies: perl-IO-Socket-IP noarch 0.39-5.el8 appstream 47 k perl-IO-Socket-SSL noarch 2.066-4.module_el8.3.0+410+ff426aa3 appstream 298 k perl-Mozilla-CA noarch 20160104-7.module_el8.3.0+416+dee7bcef appstream 15 k Enabling module streams: perl 5.26 perl-IO-Socket-SSL 2.066 perl-libwww-perl 6.34 Transaction Summary ================================================================================ Install 47 Packages Total download size: 88 M Installed size: 407 M Is this ok [y/N]: y Downloading Packages: (1/47): perl-IO-Socket-IP-0.39-5.el8.noarch.rpm 229 kB/s | 47 kB 00:00 (2/47): perl-Digest-1.17-395.el8.noarch.rpm 78 kB/s | 27 kB 00:00 (3/47): perl-Digest-MD5-2.55-396.el8.aarch64.rp 104 kB/s | 37 kB 00:00 (4/47): perl-Mozilla-CA-20160104-7.module_el8.3 100 kB/s | 15 kB 00:00 (5/47): perl-IO-Socket-SSL-2.066-4.module_el8.3 527 kB/s | 298 kB 00:00 (6/47): perl-Net-SSLeay-1.88-1.module_el8.3.0+4 816 kB/s | 372 kB 00:00 (7/47): libaio-0.3.112-1.el8.aarch64.rpm 222 kB/s | 33 kB 00:00 (8/47): perl-URI-1.73-3.el8.noarch.rpm 243 kB/s | 116 kB 00:00 (9/47): perl-Data-Dumper-2.167-399.el8.aarch64. 400 kB/s | 57 kB 00:00 (10/47): perl-Carp-1.42-396.el8.noarch.rpm 131 kB/s | 30 kB 00:00 (11/47): perl-libnet-3.11-3.el8.noarch.rpm 206 kB/s | 121 kB 00:00 (12/47): perl-Exporter-5.72-396.el8.noarch.rpm 216 kB/s | 34 kB 00:00 (13/47): perl-Errno-1.28-416.el8.aarch64.rpm 158 kB/s | 76 kB 00:00 (14/47): perl-File-Path-2.15-2.el8.noarch.rpm 155 kB/s | 38 kB 00:00 (15/47): perl-File-Temp-0.230.600-1.el8.noarch. 177 kB/s | 63 kB 00:00 (16/47): perl-Encode-2.97-3.el8.aarch64.rpm 1.6 MB/s | 1.5 MB 00:00 (17/47): perl-Getopt-Long-2.50-4.el8.noarch.rpm 141 kB/s | 63 kB 00:00 (18/47): perl-HTTP-Tiny-0.074-1.el8.noarch.rpm 132 kB/s | 58 kB 00:00 (19/47): perl-IO-1.38-416.el8.aarch64.rpm 288 kB/s | 141 kB 00:00 (20/47): perl-MIME-Base64-3.15-396.el8.aarch64. 84 kB/s | 31 kB 00:00 (21/47): perl-Pod-Escapes-1.07-395.el8.noarch.r 80 kB/s | 20 kB 00:00 (22/47): perl-PathTools-3.74-1.el8.aarch64.rpm 189 kB/s | 90 kB 00:00 (23/47): perl-Pod-Usage-1.69-395.el8.noarch.rpm 246 kB/s | 34 kB 00:00 (24/47): perl-Pod-Perldoc-3.28-396.el8.noarch.r 166 kB/s | 86 kB 00:00 (25/47): perl-Pod-Simple-3.35-395.el8.noarch.rp 588 kB/s | 213 kB 00:00 (26/47): perl-Storable-3.11-3.el8.aarch64.rpm 245 kB/s | 95 kB 00:00 (27/47): perl-Scalar-List-Utils-1.49-2.el8.aarc 144 kB/s | 67 kB 00:00 (28/47): perl-Socket-2.027-3.el8.aarch64.rpm 130 kB/s | 59 kB 00:00 (29/47): perl-Term-ANSIColor-4.06-396.el8.noarc 137 kB/s | 46 kB 00:00 (30/47): perl-Text-ParseWords-3.30-395.el8.noar 52 kB/s | 18 kB 00:00 (31/47): perl-Term-Cap-1.17-395.el8.noarch.rpm 59 kB/s | 23 kB 00:00 (32/47): perl-Text-Tabs+Wrap-2013.0523-395.el8. 97 kB/s | 24 kB 00:00 (33/47): perl-Time-Local-1.280-1.el8.noarch.rpm 134 kB/s | 34 kB 00:00 (34/47): perl-Unicode-Normalize-1.25-396.el8.aa 293 kB/s | 78 kB 00:00 (35/47): perl-constant-1.33-396.el8.noarch.rpm 64 kB/s | 25 kB 00:00 (36/47): perl-macros-5.26.3-416.el8.aarch64.rpm 310 kB/s | 72 kB 00:00 (37/47): perl-parent-0.237-1.el8.noarch.rpm 77 kB/s | 20 kB 00:00 (38/47): perl-libs-5.26.3-416.el8.aarch64.rpm 1.6 MB/s | 1.5 MB 00:00 (39/47): perl-interpreter-5.26.3-416.el8.aarch6 5.6 MB/s | 6.3 MB 00:01 (40/47): perl-podlators-4.11-1.el8.noarch.rpm 303 kB/s | 118 kB 00:00 (41/47): perl-threads-2.21-2.el8.aarch64.rpm 132 kB/s | 60 kB 00:00 (42/47): perl-threads-shared-1.58-2.el8.aarch64 134 kB/s | 47 kB 00:00 (43/47): mysql-community-client-plugins-8.0.22- 88 kB/s | 106 kB 00:01 (44/47): mysql-community-common-8.0.22-1.el8.aa 451 kB/s | 620 kB 00:01 (45/47): mysql-community-client-8.0.22-1.el8.aa 5.2 MB/s | 14 MB 00:02 (46/47): mysql-community-libs-8.0.22-1.el8.aarc 914 kB/s | 1.4 MB 00:01 (47/47): mysql-community-server-8.0.22-1.el8.aa 10 MB/s | 60 MB 00:05 -------------------------------------------------------------------------------- Total 6.5 MB/s | 88 MB 00:13 warning: /var/cache/dnf/mysql80-community-4467c2595a927b0d/packages/mysql-community-client-8.0.22-1.el8.aarch64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY MySQL 8.0 Community Server 27 MB/s | 27 kB 00:00 Importing GPG key 0x5072E1F5: Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>" Fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Is this ok [y/N]: y Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : perl-Exporter-5.72-396.el8.noarch 1/47 Installing : perl-libs-4:5.26.3-416.el8.aarch64 2/47 Installing : perl-Carp-1.42-396.el8.noarch 3/47 Installing : perl-Scalar-List-Utils-3:1.49-2.el8.aarch64 4/47 Installing : perl-parent-1:0.237-1.el8.noarch 5/47 Installing : perl-Text-ParseWords-3.30-395.el8.noarch 6/47 Installing : mysql-community-common-8.0.22-1.el8.aarch64 7/47 Installing : mysql-community-client-plugins-8.0.22-1.el8.aarch6 8/47 Installing : mysql-community-libs-8.0.22-1.el8.aarch64 9/47 Running scriptlet: mysql-community-libs-8.0.22-1.el8.aarch64 9/47 Installing : mysql-community-client-8.0.22-1.el8.aarch64 10/47 Installing : perl-Term-ANSIColor-4.06-396.el8.noarch 11/47 Installing : perl-macros-4:5.26.3-416.el8.aarch64 12/47 Installing : perl-Errno-1.28-416.el8.aarch64 13/47 Installing : perl-Socket-4:2.027-3.el8.aarch64 14/47 Installing : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 15/47 Installing : perl-Unicode-Normalize-1.25-396.el8.aarch64 16/47 Installing : perl-File-Path-2.15-2.el8.noarch 17/47 Installing : perl-IO-1.38-416.el8.aarch64 18/47 Installing : perl-PathTools-3.74-1.el8.aarch64 19/47 Installing : perl-constant-1.33-396.el8.noarch 20/47 Installing : perl-threads-1:2.21-2.el8.aarch64 21/47 Installing : perl-threads-shared-1.58-2.el8.aarch64 22/47 Installing : perl-interpreter-4:5.26.3-416.el8.aarch64 23/47 Installing : perl-MIME-Base64-3.15-396.el8.aarch64 24/47 Installing : perl-IO-Socket-IP-0.39-5.el8.noarch 25/47 Installing : perl-Time-Local-1:1.280-1.el8.noarch 26/47 Installing : perl-Digest-1.17-395.el8.noarch 27/47 Installing : perl-Digest-MD5-2.55-396.el8.aarch64 28/47 Installing : perl-Net-SSLeay-1.88-1.module_el8.3.0+410+ff426aa3 29/47 Installing : perl-Data-Dumper-2.167-399.el8.aarch64 30/47 Installing : perl-File-Temp-0.230.600-1.el8.noarch 31/47 Installing : perl-Pod-Escapes-1:1.07-395.el8.noarch 32/47 Installing : perl-Storable-1:3.11-3.el8.aarch64 33/47 Installing : perl-Term-Cap-1.17-395.el8.noarch 34/47 Installing : perl-Mozilla-CA-20160104-7.module_el8.3.0+416+dee7 35/47 Installing : perl-Encode-4:2.97-3.el8.aarch64 36/47 Installing : perl-Pod-Simple-1:3.35-395.el8.noarch 37/47 Installing : perl-Getopt-Long-1:2.50-4.el8.noarch 38/47 Installing : perl-podlators-4.11-1.el8.noarch 39/47 Installing : perl-Pod-Usage-4:1.69-395.el8.noarch 40/47 Installing : perl-Pod-Perldoc-3.28-396.el8.noarch 41/47 Installing : perl-HTTP-Tiny-0.074-1.el8.noarch 42/47 Installing : perl-IO-Socket-SSL-2.066-4.module_el8.3.0+410+ff42 43/47 Installing : perl-libnet-3.11-3.el8.noarch 44/47 Installing : perl-URI-1.73-3.el8.noarch 45/47 Installing : libaio-0.3.112-1.el8.aarch64 46/47 Running scriptlet: mysql-community-server-8.0.22-1.el8.aarch64 47/47 Installing : mysql-community-server-8.0.22-1.el8.aarch64 47/47 Running scriptlet: mysql-community-server-8.0.22-1.el8.aarch64 47/47 Verifying : perl-Digest-1.17-395.el8.noarch 1/47 Verifying : perl-Digest-MD5-2.55-396.el8.aarch64 2/47 Verifying : perl-IO-Socket-IP-0.39-5.el8.noarch 3/47 Verifying : perl-IO-Socket-SSL-2.066-4.module_el8.3.0+410+ff42 4/47 Verifying : perl-Mozilla-CA-20160104-7.module_el8.3.0+416+dee7 5/47 Verifying : perl-Net-SSLeay-1.88-1.module_el8.3.0+410+ff426aa3 6/47 Verifying : perl-URI-1.73-3.el8.noarch 7/47 Verifying : perl-libnet-3.11-3.el8.noarch 8/47 Verifying : libaio-0.3.112-1.el8.aarch64 9/47 Verifying : perl-Carp-1.42-396.el8.noarch 10/47 Verifying : perl-Data-Dumper-2.167-399.el8.aarch64 11/47 Verifying : perl-Encode-4:2.97-3.el8.aarch64 12/47 Verifying : perl-Errno-1.28-416.el8.aarch64 13/47 Verifying : perl-Exporter-5.72-396.el8.noarch 14/47 Verifying : perl-File-Path-2.15-2.el8.noarch 15/47 Verifying : perl-File-Temp-0.230.600-1.el8.noarch 16/47 Verifying : perl-Getopt-Long-1:2.50-4.el8.noarch 17/47 Verifying : perl-HTTP-Tiny-0.074-1.el8.noarch 18/47 Verifying : perl-IO-1.38-416.el8.aarch64 19/47 Verifying : perl-MIME-Base64-3.15-396.el8.aarch64 20/47 Verifying : perl-PathTools-3.74-1.el8.aarch64 21/47 Verifying : perl-Pod-Escapes-1:1.07-395.el8.noarch 22/47 Verifying : perl-Pod-Perldoc-3.28-396.el8.noarch 23/47 Verifying : perl-Pod-Simple-1:3.35-395.el8.noarch 24/47 Verifying : perl-Pod-Usage-4:1.69-395.el8.noarch 25/47 Verifying : perl-Scalar-List-Utils-3:1.49-2.el8.aarch64 26/47 Verifying : perl-Socket-4:2.027-3.el8.aarch64 27/47 Verifying : perl-Storable-1:3.11-3.el8.aarch64 28/47 Verifying : perl-Term-ANSIColor-4.06-396.el8.noarch 29/47 Verifying : perl-Term-Cap-1.17-395.el8.noarch 30/47 Verifying : perl-Text-ParseWords-3.30-395.el8.noarch 31/47 Verifying : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 32/47 Verifying : perl-Time-Local-1:1.280-1.el8.noarch 33/47 Verifying : perl-Unicode-Normalize-1.25-396.el8.aarch64 34/47 Verifying : perl-constant-1.33-396.el8.noarch 35/47 Verifying : perl-interpreter-4:5.26.3-416.el8.aarch64 36/47 Verifying : perl-libs-4:5.26.3-416.el8.aarch64 37/47 Verifying : perl-macros-4:5.26.3-416.el8.aarch64 38/47 Verifying : perl-parent-1:0.237-1.el8.noarch 39/47 Verifying : perl-podlators-4.11-1.el8.noarch 40/47 Verifying : perl-threads-1:2.21-2.el8.aarch64 41/47 Verifying : perl-threads-shared-1.58-2.el8.aarch64 42/47 Verifying : mysql-community-client-8.0.22-1.el8.aarch64 43/47 Verifying : mysql-community-client-plugins-8.0.22-1.el8.aarch6 44/47 Verifying : mysql-community-common-8.0.22-1.el8.aarch64 45/47 Verifying : mysql-community-libs-8.0.22-1.el8.aarch64 46/47 Verifying : mysql-community-server-8.0.22-1.el8.aarch64 47/47 Installed: libaio-0.3.112-1.el8.aarch64 mysql-community-client-8.0.22-1.el8.aarch64 mysql-community-client-plugins-8.0.22-1.el8.aarch64 mysql-community-common-8.0.22-1.el8.aarch64 mysql-community-libs-8.0.22-1.el8.aarch64 mysql-community-server-8.0.22-1.el8.aarch64 perl-Carp-1.42-396.el8.noarch perl-Data-Dumper-2.167-399.el8.aarch64 perl-Digest-1.17-395.el8.noarch perl-Digest-MD5-2.55-396.el8.aarch64 perl-Encode-4:2.97-3.el8.aarch64 perl-Errno-1.28-416.el8.aarch64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-File-Temp-0.230.600-1.el8.noarch perl-Getopt-Long-1:2.50-4.el8.noarch perl-HTTP-Tiny-0.074-1.el8.noarch perl-IO-1.38-416.el8.aarch64 perl-IO-Socket-IP-0.39-5.el8.noarch perl-IO-Socket-SSL-2.066-4.module_el8.3.0+410+ff426aa3.noarch perl-MIME-Base64-3.15-396.el8.aarch64 perl-Mozilla-CA-20160104-7.module_el8.3.0+416+dee7bcef.noarch perl-Net-SSLeay-1.88-1.module_el8.3.0+410+ff426aa3.aarch64 perl-PathTools-3.74-1.el8.aarch64 perl-Pod-Escapes-1:1.07-395.el8.noarch perl-Pod-Perldoc-3.28-396.el8.noarch perl-Pod-Simple-1:3.35-395.el8.noarch perl-Pod-Usage-4:1.69-395.el8.noarch perl-Scalar-List-Utils-3:1.49-2.el8.aarch64 perl-Socket-4:2.027-3.el8.aarch64 perl-Storable-1:3.11-3.el8.aarch64 perl-Term-ANSIColor-4.06-396.el8.noarch perl-Term-Cap-1.17-395.el8.noarch perl-Text-ParseWords-3.30-395.el8.noarch perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch perl-Time-Local-1:1.280-1.el8.noarch perl-URI-1.73-3.el8.noarch perl-Unicode-Normalize-1.25-396.el8.aarch64 perl-constant-1.33-396.el8.noarch perl-interpreter-4:5.26.3-416.el8.aarch64 perl-libnet-3.11-3.el8.noarch perl-libs-4:5.26.3-416.el8.aarch64 perl-macros-4:5.26.3-416.el8.aarch64 perl-parent-1:0.237-1.el8.noarch perl-podlators-4.11-1.el8.noarch perl-threads-1:2.21-2.el8.aarch64 perl-threads-shared-1.58-2.el8.aarch64 Complete!起動・初期設定
MySQLサーバ起動・初期設定$ sudo systemctl enable mysqld.service $ sudo systemctl start mysqld.service $ sudo fgrep assword /var/log/mysqld.log 2020-12-18T13:08:42.554021Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 【初期パスワード】 $ 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) : n ... 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! $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 8.0.22 MySQL Community Server - GPL Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select * from performance_schema.global_variables where variable_name in ("innodb_buffer_pool_size", "innodb_log_file_size", "innodb_flush_method"); +-------------------------+----------------+ | VARIABLE_NAME | VARIABLE_VALUE | +-------------------------+----------------+ | innodb_buffer_pool_size | 134217728 | | innodb_flush_method | fsync | | innodb_log_file_size | 50331648 | +-------------------------+----------------+ 3 rows in set (0.00 sec) mysql> quit Bye
innodb_dedicated_server=ON
で起動してみます(参考:MySQL 8.0 の innodb_dedicated_server について)。innodb_dedicated_server=ONで起動$ sudo systemctl stop mysqld.service $ vi /etc/my.cnf ※末尾に「innodb_dedicated_server=ON」を追記して保存 $ systemctl start mysqld.service $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.22 MySQL Community Server - GPL Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select * from performance_schema.global_variables where variable_name in ("innodb_buffer_pool_size", "innodb_log_file_size", "innodb_flush_method"); +-------------------------+-------------------+ | VARIABLE_NAME | VARIABLE_VALUE | +-------------------------+-------------------+ | innodb_buffer_pool_size | 12884901888 | | innodb_flush_method | O_DIRECT_NO_FSYNC | | innodb_log_file_size | 1073741824 | +-------------------------+-------------------+ 3 rows in set (0.01 sec)以上です。
次回(MySQL Advent Calendar 2020 21 日目)はこの環境を r5.large インスタンスと比較してみます。
- Qiitaに投稿したMySQL 8.0関連記事
- MySQL 8.0 の薄い本(無料で配布中!)
- 投稿日:2020-12-18T23:26:12+09:00
cloud9でmySQL開始の際に使用したコマンド
cloud9
からmysql
利用する際に使ったコマンド一覧
new terminal
から新規ターミナルを作成し以下のコードを打つsql利用開始ec2-user:~/environment $ sudo service mysqld startsqlログインec2-user:~/environment $ mysql -u root -p※パスワード未設定の時は
-p
つけないUTF対応してるか確認SHOW VARIABLES LIKE "chara%";↓このようになっていればOK、なっていない場合はこちら
ユーザ作成create user ' summon_fire`@`localhost' IDENTIFIED BY 'password';パスワード変更set password for 'name'@'localhost' = password('pass');ユーザ削除drop user summon_fire@localhost;DB一覧show databases;DB作成create database new_db_name;DB使用use new_db_name;データ型設定(id自動採番)create table new_teble_name( id INT(11) AUTO_INCREMENT NOT NULL, name VARCHAR(30) NOT NULL , age INT(3) NOT NULL, PRIMARY KEY (id));<データ型>
INT
・・・数値型
FLOAT
・・・浮動小数点型
DECIMAL
・・・正確性が求められる金銭などのデータを扱う
char
・・・固定長の文字列
VARCHAR
・・・可変長の文字列
TEXT
・・・可変長の文字列型
DATE
・・・YYYY-MM-DD
TIME
・・・HH:MM:SS.SSSSSSS
DATETIME
・・・日付と時刻を併せ持つデータ型.<指定可能なオプション>
UNIQUE
・・・重複NG
DEFAULT
・・・未入力時に表示する用のデフォ値
PRIMARY KEY
・・・主キーに設定
AUTO_INCREMENT
・・・自動採番
NOT NULL
・・・入力必須項目昇順、降順desc new_table_name; asc new_table_name;INSERT文insert into new_table_name (id, name, age) VALUES (1,'山田', 23);SELECT文select from new_table_name where id=1; └条件句APDETE文UPDATE new_table_name SET age = 10 WHERE age = 5;└ageが5のカラムのageを10に変更
DELETE文delete FROM new_table_name WHERE age = 5;└age=5のカラムを削除
DELETE文delete from new_table_name;└全削除
終了exit Bye
- 投稿日:2020-12-18T23:24:40+09:00
【cakephp3】全てのテーブルとカラムにコメントを付与する作業メモ
前提条件
cakephp3.xでmysqlを使用していること。
手順
1. mysqldumpでスキーマのDB定義のみを出力した 『バックアップA』 を作成
mysqldump -u {ユーザー} -p -h {DBサーバホスト} {DBスキーマ名} -d -n > schema-dump-A.sql2. 現在のDBからマイグレーションファイルを作成
bin/cake bake migration_snapshot {マイグレーション名}3. マイグレーションファイルを編集
- downメソッド の中身をごっそり消す
- テーブルコメント更新用のSQL処理追加
- createメソッド を updateメソッド に置換
- addColumnメソッド を changeColumnメソッド に置換
- カラムコメント追加
- addIndex の部分のコードはトルツメ
- idのchangeColumn処理追加(auto_incrementなどが元々の制約が消えないようにオプションの引数を注意する。コメントしない場合は不要。)
マイグレーションファイルuse Migrations\AbstractMigration; use Cake\Datasource\ConnectionManager;// ← テーブルコメント更新用のSQL処理で必要なので追加 class {マイグレーション名} extends AbstractMigration { public function up() { // 例) user(ユーザー)テーブルの場合 // ↓ テーブルコメント更新用のSQL処理追加 $connection = ConnectionManager::get('default'); $connection->execute('ALTER TABLE user COMMENT :table_comment', [ 'table_comment' => 'ユーザー' ]); $this->table('user') // ↓ idのchangeColumn処理追加 ->changeColumn('id', 'integer', ['comment' => 'ID','identity' => true]) // ↓ addColumnメソッド を changeColumnメソッド に置換 ->changeColumn('name', 'string', [ 'default' => null, 'limit' => 255, 'null' => true, 'comment' => '名前' // ← カラムコメント追加 ]) // × addIndex の部分のコードはトルツメ ->update(); // ← createメソッド を updateメソッド に置換 } public function down() { // 使わないので空にする } }4. マイグレーション実行
bin/cake migrations migrate5. 再びmysqldumpでスキーマのDB定義のみを出力した 『バックアップB』 を作成
mysqldump -u {ユーザー} -p -h {DBサーバホスト} {DBスキーマ名} -d -n > schema-dump-B.sql6. 『バックアップA』 と 『バックアップB』をテキスト差分比較しコメントだけ追加できているかチェック
コメントだけ追加できていれば成功。
もしそれ以外の箇所が違うものが書き換わっていた場合はシステムに影響が出るかもしれないので影響確認が必要。
なるべくバックアップAと一致するようにマイグレーションファイルを修正する。
- 投稿日:2020-12-18T23:24:40+09:00
【Cakephp】全てのテーブルとカラムにコメントを付与する作業メモ
前提条件
cakephp3.xでmysqlを使用していること。
手順
1. mysqldumpでスキーマのDB定義のみを出力した 『バックアップA』 を作成
mysqldump -u {ユーザー} -p -h {DBサーバホスト} {DBスキーマ名} -d -n > schema-dump-A.sql2. 現在のDBからマイグレーションファイルを作成
bin/cake bake migration_snapshot {マイグレーション名}3. マイグレーションファイルを編集
- downメソッド の中身をごっそり消す
- テーブルコメント更新用のSQL処理追加
- createメソッド を updateメソッド に置換
- addColumnメソッド を changeColumnメソッド に置換
- カラムコメント追加
- addIndex の部分のコードはトルツメ
- idのchangeColumn処理追加(auto_incrementなどが元々の制約が消えないようにオプションの引数を注意する。コメントしない場合は不要。)
マイグレーションファイルuse Migrations\AbstractMigration; use Cake\Datasource\ConnectionManager;// ← テーブルコメント更新用のSQL処理で必要なので追加 class {マイグレーション名} extends AbstractMigration { public function up() { // 例) user(ユーザー)テーブルの場合 // ↓ テーブルコメント更新用のSQL処理追加 $connection = ConnectionManager::get('default'); $connection->execute('ALTER TABLE user COMMENT :table_comment', [ 'table_comment' => 'ユーザー' ]); $this->table('user') // ↓ idのchangeColumn処理追加 ->changeColumn('id', 'integer', ['comment' => 'ID','identity' => true]) // ↓ addColumnメソッド を changeColumnメソッド に置換 ->changeColumn('name', 'string', [ 'default' => null, 'limit' => 255, 'null' => true, 'comment' => '名前' // ← カラムコメント追加 ]) // × addIndex の部分のコードはトルツメ ->update(); // ← createメソッド を updateメソッド に置換 } public function down() { // 使わないので空にする } }4. マイグレーション実行
bin/cake migrations migrate5. 再びmysqldumpでスキーマのDB定義のみを出力した 『バックアップB』 を作成
mysqldump -u {ユーザー} -p -h {DBサーバホスト} {DBスキーマ名} -d -n > schema-dump-B.sql6. 『バックアップA』 と 『バックアップB』をテキスト差分比較しコメントだけ追加できているかチェック
コメントだけ追加できていれば成功。
もしそれ以外の箇所が違うものが書き換わっていた場合はシステムに影響が出るかもしれないので影響確認が必要。
なるべくバックアップAと一致するようにマイグレーションファイルを修正する。トラブルシューティングTIPS
問題の箇所だけテーブルコメントみたいにSQLを直接実行する方式に置き換えれば大概解決できますが、マイグレーションのソースコードを直して解決できたものをまとめてます。
ON UPDATE CURRENT_TIMESTAMP が取れる場合
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ↓ マイグレーション後コメント付与後 `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '変更日時',対応
MYSQL default value: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
このissueによるとchangeColumnに第3引数の配列にupdateを追加すれば良いみたい。
手順どおりのままだと自動追加されないみたいなのでマイグレーションを修正。->changeColumn('modified', 'timestamp', [ 'default' => 'CURRENT_TIMESTAMP', 'limit' => null, 'null' => false, 'update' => 'CURRENT_TIMESTAMP', // ← 追加 'comment' => '変更日時' ])
- 投稿日:2020-12-18T23:14:56+09:00
登録した情報をなかったことするコマンド
- 投稿日:2020-12-18T22:54:57+09:00
Cloud9 MySQLの文字化け対応
Cloud9にはデフォでMySQLがインストールされていますが日本語未対応で文字化けしてしまうのでUTF-8に対応できるように設定します。
1.
new terminal
からターミナルに以下のvi
コマンド(ファイルを開くLinuxコマンド)で展開sudo vi /etc/my.cnf続いてキーボードの
i
キー(Linuxコマンド)を押下しターミナルを編集可能にする2.
[mysqld]
セクションに挿入挿入場所は
[mysqld]
と[mysqld_safe]
の間character-set-server=utf8 [client] default-character-set=utf83.編集完了
Esc
キーで編集モードを終了し、q:
(Linuxコマンドの強制終了)を入力してEnter
キーこれでMySqlはUTF-8に対応しているはずなので実際に開いて確認してみましょう。
確認方法はこちら
- 投稿日:2020-12-18T19:30:10+09:00
mySQL パスワードが入力できない 表示されない
超初心者向けですが…
パスワードを入力しても「*****」も何も出なくて私は小一時間苦しみました。
完全に非表示な仕様なだけでキーボードになんの問題もありません。passEnter password>カーソルが微動だにしなくてもめげずにパスワードを入力して、
Enter
してください。
ログインできます。
- 投稿日:2020-12-18T19:30:10+09:00
MySQL パスワードが入力できない 表示されない
超初心者向けですが…
この記事に辿り着いたという事は
パスワードを入力しても「*****」もカーソル移動しない、何も表示されない、私は小一時間苦しみました。コマンドプロンプトだとちゃんと「*****」が表示されると思いますが、中には非表示な仕様のもあるだけでキーボードになんの問題もありません。passEnter password>カーソルが微動だにしなくてもめげずにパスワードを入力して、
Enter
してください。
ログインできます。
- 投稿日:2020-12-18T18:47:19+09:00
Laravel(多対多)でphp artisan migrateエラー(SQLSTATE[42S01]: Base table or view already exists:)が出た時
Laravelで多対多のデータベース接続を行っている際、php artisan migrateコマンドを入力すると、下記のエラーが出ました。
すでにデータベースにテーブルが存在すると言われて困惑しましたが、
一度データベースから直接テーブルを削除して、再度php artisan migrateを行うと問題なく解決しました。何も変更を加えず、やり直すだけで解決する場合もあるので、一度試してみてください。
- 投稿日:2020-12-18T17:35:31+09:00
Docker環境でMySQLのログを確認する
まず、dockerのMySQLコンテナに入ります。
MySQLサーバにログインして、以下のようにgeneral_log
の位置を確認します。mysql> show variables like 'general_log%'; +------------------+---------------------------------+ | Variable_name | Value | +------------------+---------------------------------+ | general_log | OFF | | general_log_file | /var/lib/mysql/55ca40b8744.log | +------------------+---------------------------------+ 2 rows in set (0.00 sec)
OFF
になっているので、ON
にします。
こうしないとファイルが出現しないようです。mysql> set global general_log = on; Query OK, 0 rows affected (0.01 sec)MySQLからぬけて、
var/lib/mysql
に移動します。ここのファイルの内容を参照すれば見れます。root@55ca40b8744e:~# cd /var/lib/mysql root@55ca40b8744e:/var/lib/mysql# cat 55ca40b8744.log Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock Time Id Command Argument 2020-12-18T17:18:27.044729+09:00 26 Quit先ほど MySQLのサーバを抜けたので、Quitしたと出ています。
試しに
delete
したときのログは以下のように出ます。2020-12-18T17:02:09.716428+09:00 67 Prepare DELETE FROM `TABLE` WHERE `table`.`id` = ? 2020-12-18T17:02:09.716513+09:00 67 Execute DELETE FROM `TABLE` WHERE `table`.`id` = 0
- 投稿日:2020-12-18T10:55:26+09:00
rails newでmysqlのインストールが失敗する
初めてのQiita投稿になります!当初はRailsとVueのタスク管理アプリを作りながら記事を書くつもりでしたが、rails newの時点でmyqlのインストールが上手くいかずに躓いたので、こちらの記事を書くことにしました。
ただ、解決方法は最後に書いており、それまでは解決方法にたどり着くまでのストーリーになっているので飛ばしてもらった方がいいです。筆者自身の備忘録も読みたい方は上から読んで頂ければと思います。
環境は見れば分かる人もいるかもしれませんが、Macです。(zshでbrewを使っていればMacですよね?)
最近知ったのですが、zshはジーシェルって読むらしいです。プロジェクト開始のはずが
何はともあれ、rails newですね。
% rails -v Rails 6.0.3.4 % rails new memo-memo -d mysql --skip-test早速エラーが発生しましたw
An error occurred while installing mysql2 (0.5.3), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'` succeeds before bundling.言われた通りにやります。
% gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'Pemission errorが発生したのでここも思考停止でsudoをつけます。
% sudo gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'今度は良くわからないですね。
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load ----- ----- Setting libpath to /usr/local/Cellar/mysql/8.0.22_1/libそもそもMacに正しくmysqlが入っていることを確認してみます。
するとBrewさんは私に不満があるらしく色々とヒントをくれました。% brew info mysql mysql: stable 8.0.22 (bottled) Open source relational database management system https://dev.mysql.com/doc/refman/8.0/en/ Conflicts with: mariadb (because mysql, mariadb, and percona install the same binaries) percona-server (because mysql, mariadb, and percona install the same binaries) /usr/local/Cellar/mysql/8.0.22_1 (294 files, 296.5MB) * Poured from bottle on 2020-12-13 at 08:50:29 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/mysql.rb License: GPL-2.0 ==> Dependencies Build: cmake ✘ Required: openssl@1.1 ✔, protobuf ✔ ==> Caveats We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation MySQL is configured to only allow connections from localhost by default To connect run: mysql -uroot To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start ==> Analytics install: 85,291 (30 days), 236,256 (90 days), 823,613 (365 days) install-on-request: 83,799 (30 days), 231,594 (90 days), 798,215 (365 days) build-error: 0 (30 days)どうやらmariadbとpercona-serverがconflictを起こしていることとcmakeがインストールされていないことが悪いのかなと考えました。そこでまず、簡単な方のcmakeをインストールを試してみました。その後再度brew info mysqlを叩いてみました。
% brew install cmake % brew info mysqlとりあえず、cmakeの✖️からレ点に変わったので進歩しました。一応、mysqlがinstallできるか確認してみました。
% sudo gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'相変わらずインストールができないことが確認できました。今度はしっかりとエラーを確認してみます。
Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. current directory: /Library/Ruby/Gems/2.6.0/gems/mysql2-0.5.3/ext/mysql2 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20201218-6446-1qkv5ft.rb extconf.rb checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for rb_wait_for_single_fd()... yes ----- Using mysql_config at /usr/local/bin/mysql_config ----- checking for mysql.h... yes checking for errmsg.h... yes checking for SSL_MODE_DISABLED in mysql.h... yes checking for SSL_MODE_PREFERRED in mysql.h... yes checking for SSL_MODE_REQUIRED in mysql.h... yes checking for SSL_MODE_VERIFY_CA in mysql.h... yes checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes checking for MYSQL.net.vio in mysql.h... yes checking for MYSQL.net.pvio in mysql.h... no checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes checking for my_bool in mysql.h... no ----- Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load ----- ----- Setting libpath to /usr/local/Cellar/mysql/8.0.22_1/lib ----- creating Makefile current directory: /Library/Ruby/Gems/2.6.0/gems/mysql2-0.5.3/ext/mysql2 make "DESTDIR=" clean current directory: /Library/Ruby/Gems/2.6.0/gems/mysql2-0.5.3/ext/mysql2 make "DESTDIR=" compiling client.c compiling infile.c compiling mysql2_ext.c compiling result.c compiling statement.c linking shared-object mysql2/mysql2.bundle ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.Internal.sdk/usr/local/lib' ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [mysql2.bundle] Error 1 make failed, exit code 2 Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/mysql2-0.5.3 for inspection. Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/mysql2-0.5.3/gem_make.outlibpathを通した方がいいのかな?と思い通してみます。(この解釈は間違っていることにあとで気付きます)
% export LIBRARY_PATH=/usr/local/Cellar/mysql/8.0.22_1/lib % sudo gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'しかし、エラー内容が変わらず。ここでCreating Makefileの後にゴニョゴニョ書いていることからgem installするときに何かしらのMakefileを実行していて、その途中でld: liblary not found for -lsslで失敗してインストールが失敗しているのではないかと考えました。(間違っていたらすみません。)
ここで白旗を上げて、同じ問題に当たっている人を探すことにしました。すると以下の優良な記事がヒットしました!
mysql2 gemインストール時のトラブルシュートここをみてもらえば最初から解決できる話でしたww
ここまで読んでくれた人は申し訳ございませんでした。Qiitaを書きながらなのリアルなエラー解決のストーリーとなっているのでご了承ください。意訳すると、LIBRARY_PATH=/usr/local/Cellar/mysql/8.0.22_1/libにパスを設定したけど、お目当てのライブラリーが見つからないためにlibrary not foundになっていて、--with-cppflagsと--with-ldflagsを指定することでちゃんとライブラリーが見つけれるようになって、インストールできるよになるという話です。正確には元記事を参考にしてください。
解決方法
% brew info openssl For compilers to find openssl you may need to set: export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include" % sudo gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/' -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib % bundle installお疲れ様でした。もしrails newしたけど、mysqlのインストールでつまづいた人がいれば参考にしていただければ幸いです。
- 投稿日:2020-12-18T04:13:25+09:00
Laravel(多対多)でphp artisan migrateエラー(SQLSTATE[HY000]: General error: 3780 Referencing column~are incompatible.)
Laravelでphp artisan migrateを実行し、SQLSTATE[HY000]: General error: 3780 Referencing column~are incompatibleといったエラーが出てきた場合、設定しているカラムタイプが異なることが原因である場合があります。
「are incompatible」は直訳すると互換性がないと言われています。//符号なしBIGINTを使用した自動増分ID(主キー) $table->bigIncrements('id'); //BIGINTカラム $table->bigInteger('votes');今一度、自分で設定したカラムタイプの整合性が取れているか確認してみてください。