質問編集履歴

1

サーバーがインストールできていなかった

2021/02/06 05:50

投稿

mocha1325
mocha1325

スコア20

test CHANGED
File without changes
test CHANGED
@@ -12,6 +12,52 @@
12
12
 
13
13
 
14
14
 
15
+ ### 現状
16
+
17
+
18
+
19
+ 容量が足りておらずサーバーをインストールできていなかったようなので
20
+
21
+ 容量を追加し、サーバーがインストールできました。
22
+
23
+
24
+
25
+ ```php
26
+
27
+ $ sudo yum install mysql-server
28
+
29
+ ```
30
+
31
+ > Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
32
+
33
+ amzn2-core | 3.7 kB 00:00:00
34
+
35
+ 263 packages excluded due to repository priority protections
36
+
37
+ Package mysql-community-server-8.0.23-1.el7.x86_64 already installed and latest version
38
+
39
+ Nothing to do
40
+
41
+
42
+
43
+ ```php
44
+
45
+ $ mysql --version
46
+
47
+ ```
48
+
49
+ > mysql Ver 8.0.23 for Linux on x86_64 (MySQL Community Server - GPL)
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
15
61
  ### 発生している問題
16
62
 
17
63
 
@@ -20,128 +66,172 @@
20
66
 
21
67
  ```php
22
68
 
23
- $ mysql -u root
69
+ $ systemctl status mysqld.service
24
-
70
+
25
- ```
71
+ ```
72
+
26
-
73
+ > ● mysqld.service - MySQL Server
74
+
27
- > ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
75
+ Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
76
+
77
+ Active: failed (Result: exit-code) since Sat 2021-02-06 04:37:47 UTC; 13s ago
78
+
79
+ Docs: man:mysqld(8)
80
+
81
+ http://dev.mysql.com/doc/refman/en/using-systemd.html
82
+
83
+ Process: 17375 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
84
+
85
+ Process: 17289 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
86
+
87
+ Main PID: 17375 (code=exited, status=1/FAILURE)
88
+
89
+ Status: "Server startup in progress"
90
+
91
+ Error: 13 (Permission denied)
92
+
93
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld_pre_systemd[17289]: 2021-0...
94
+
95
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld_pre_systemd[17289]: 2021-0...
96
+
97
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
98
+
99
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
100
+
101
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
102
+
103
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
104
+
105
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: mysqld.service: main ...
106
+
107
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: Failed to start MySQL...
108
+
109
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: Unit mysqld.service e...
110
+
111
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: mysqld.service failed.
112
+
113
+ Hint: Some lines were ellipsized, use -l to show in full.
114
+
115
+
116
+
117
+
28
118
 
29
119
 
30
120
 
31
121
  となったので、
32
122
 
33
- [mysql.sockを削除したら改善したという方ブログ](https://www.ten-kyuu.com/error-socket/)に沿って再挑戦しましたがエラー
34
-
35
-
36
-
37
- その後
38
-
39
- ```php
40
-
41
- $ sudo service mysqld start
42
-
43
- ```
44
-
45
- > Redirecting to /bin/systemctl start mysqld.service
46
-
47
- Failed to start mysqld.service: Unit not found.
48
-
49
-
50
-
51
- というエラーが出たので
52
-
53
- [こちら](https://qiita.com/miriwo/items/e7afd5e1ae0de94f27c2)の情報を元にインストールされているものを消してみたり、再度インストールしてみたりいろいろ試してみましたがこちらの通りにはなりませんでした。
54
-
55
-
56
-
57
- 先程の[こちら](https://qiita.com/miriwo/items/e7afd5e1ae0de94f27c2)のかたが[参考にされていたブログ](https://saton2.hatenablog.com/entry/2018/10/16/200616)も試してみましたがダメでした。。
58
-
59
-
60
-
61
-
62
-
63
- どの方法を試してもエラーが出てしまい、様々な記事を読み漁り、一度cloud9を作り直しましたが解決しません。
64
-
65
-
66
-
67
-
68
-
69
- ### 出力結果たち
70
-
71
-
72
-
73
- ```php
74
-
75
- mysql -u root -p
76
-
77
- ```
78
-
79
- > ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
80
-
81
-
82
-
83
- ```php
84
-
85
- sudo systemctl status mysql
86
-
87
- ```
88
-
89
- > Unit mysql.service could not be found.
90
-
91
-
92
-
93
- ```php
94
-
95
- $ mysql --version
96
-
97
- ```
98
-
99
- > mysql Ver 8.0.23 for Linux on x86_64 (MySQL Community Server - GPL)
100
-
101
-
102
-
103
- ```php
104
-
105
- yum list installed mysql*
106
-
107
- ```
108
-
109
- > Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
110
-
111
- 263 packages excluded due to repository priority protections
112
-
113
- Installed Packages
114
-
115
- mysql-community-client.x86_64 8.0.23-1.el7 @mysql80-community
116
-
117
- mysql-community-client-plugins.x86_64 8.0.23-1.el7 @mysql80-community
118
-
119
- mysql-community-common.x86_64 8.0.23-1.el7 @mysql80-community
120
-
121
- mysql-community-devel.x86_64 8.0.23-1.el7 @mysql80-community
122
-
123
- mysql-community-libs.x86_64 8.0.23-1.el7 @mysql80-community
124
-
125
- mysql80-community-release.noarch el7-3 installed
126
-
127
-
128
-
129
- ```php
130
-
131
- sudo systemctl status mysql
132
-
133
- ```
134
-
135
- > Unit mysql.service could not be found.
136
-
137
-
138
-
139
- どの情報が手がかりとなるがわかっていないため
140
-
141
- 大変わかりくい部分あるかと思いがお力沿いいただきたく存じま????????‍♀️
142
-
143
-
144
-
145
- ここまで読んでさりありがとうございました
146
-
147
- よろしくお願ます????????‍♀️????????‍♀️
123
+ [記事](https://qiita.com/miriwo/items/e7afd5e1ae0de94f27c2)を参考起動ログを確認
124
+
125
+ ```php
126
+
127
+ sudo vi /var/log/mysqld.log
128
+
129
+ ```
130
+
131
+ > 2021-02-06T04:19:01.653849Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.23) initializing of server in progress as process 15948
132
+
133
+ 2021-02-06T04:19:01.655447Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
134
+
135
+ 2021-02-06T04:19:01.655475Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
136
+
137
+ 2021-02-06T04:19:01.655552Z 0 [ERROR] [MY-010119] [Server] Aborting
138
+
139
+ 2021-02-06T04:19:01.655679Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
140
+
141
+
142
+
143
+
144
+
145
+ /var/lib/mysql/が使用できないと書かれているようなので、下記コマンドで削除してもう一度試してみても変わりなしです。。
146
+
147
+ ```php
148
+
149
+ sudo rm -rf /var/lib/mysql
150
+
151
+ ```
152
+
153
+
154
+
155
+
156
+
157
+ ```php
158
+
159
+ less /var/log/mysqld.log
160
+
161
+ ```
162
+
163
+ > 2021-02-06T02:57:16.556954Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.23) initializing of server in progress as process 10685
164
+
165
+ 2021-02-06T02:57:16.558684Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
166
+
167
+ 2021-02-06T02:57:16.558710Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
168
+
169
+ 2021-02-06T02:57:16.558771Z 0 [ERROR] [MY-010119] [Server] Aborting
170
+
171
+ 2021-02-06T02:57:16.558895Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
172
+
173
+
174
+
175
+ やはり/var/lib/mysql/についてのエラーが出るので/var/libからmysqlを削除してみて
176
+
177
+ 削除できたことを確認後、もう一度実行しましたが同じエラーになったので起動ログをみてみましたが変わりなしです。
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+ ### その他試してみたこと
186
+
187
+ ```php
188
+
189
+ $ journalctl -xe
190
+
191
+ ```
192
+
193
+ > -- Unit mysqld.service has begun starting up.
194
+
195
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.277076Z 0 [System] [MY-010116]
196
+
197
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.279385Z 0 [ERROR] [MY-010187] [
198
+
199
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.280569Z 0 [ERROR] [MY-010119] [
200
+
201
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.280726Z 0 [System] [MY-010910]
202
+
203
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal sudo[21540]: pam_unix(sudo:session): session closed for user root
204
+
205
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: mysqld.service: main process exited, code=exited, stat
206
+
207
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: Failed to start MySQL Server.
208
+
209
+ -- Subject: Unit mysqld.service has failed
210
+
211
+ -- Defined-By: systemd
212
+
213
+ -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
214
+
215
+ --
216
+
217
+ -- Unit mysqld.service has failed.
218
+
219
+ --
220
+
221
+ -- The result is failed.
222
+
223
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: Unit mysqld.service entered failed state.
224
+
225
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: mysqld.service failed.
226
+
227
+
228
+
229
+
230
+
231
+ この他にもエラーを元に様々なブログを読みは試しを繰り返しした手上げ状態で、、
232
+
233
+
234
+
235
+ ここまで読んでいたありがとうございました
236
+
237
+ ご回答いただけますと幸いですm(_ _)m