teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

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

2021/02/06 05:50

投稿

mocha1325
mocha1325

スコア20

title CHANGED
File without changes
body CHANGED
@@ -5,70 +5,115 @@
5
5
 
6
6
 
7
7
 
8
- ### 発生している問題
8
+ ### 現状
9
9
 
10
+ 容量が足りておらずサーバーをインストールできていなかったようなので
11
+ 容量を追加し、サーバーがインストールできました。
10
12
 
11
13
  ```php
12
- $ mysql -u root
14
+ $ sudo yum install mysql-server
13
15
  ```
16
+ > Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
14
- > ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
17
+ amzn2-core | 3.7 kB 00:00:00
18
+ 263 packages excluded due to repository priority protections
19
+ Package mysql-community-server-8.0.23-1.el7.x86_64 already installed and latest version
20
+ Nothing to do
15
21
 
16
- となったので、
17
- [mysql.sockを削除したら改善したという方のブログ](https://www.ten-kyuu.com/error-socket/)に沿って再挑戦しましたがエラー
18
-
19
- その後
20
22
  ```php
21
- $ sudo service mysqld start
23
+ $ mysql --version
22
24
  ```
23
- > Redirecting to /bin/systemctl start mysqld.service
25
+ > mysql Ver 8.0.23 for Linux on x86_64 (MySQL Community Server - GPL)
24
- Failed to start mysqld.service: Unit not found.
25
26
 
26
- というエラーが出たので
27
- [こちら](https://qiita.com/miriwo/items/e7afd5e1ae0de94f27c2)の情報を元にインストールされているものを消してみたり、再度インストールしてみたりいろいろ試してみましたがこちらの通りにはなりませんでした。
28
27
 
29
- 先程の[こちら](https://qiita.com/miriwo/items/e7afd5e1ae0de94f27c2)のかたが[参考にされていたブログ](https://saton2.hatenablog.com/entry/2018/10/16/200616)も試してみましたがダメでした。。
30
28
 
31
29
 
32
- どの方法を試してもエラーが出てしまい、様々な記事を読み漁り、一度cloud9を作り直しましたが解決しません。
33
30
 
31
+ ### 発生している問題
34
32
 
35
- ### 出力結果たち
36
33
 
37
34
  ```php
38
- mysql -u root -p
35
+ $ systemctl status mysqld.service
39
36
  ```
37
+ > ● mysqld.service - MySQL Server
40
- > ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
38
+ Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
39
+ Active: failed (Result: exit-code) since Sat 2021-02-06 04:37:47 UTC; 13s ago
40
+ Docs: man:mysqld(8)
41
+ http://dev.mysql.com/doc/refman/en/using-systemd.html
42
+ Process: 17375 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
43
+ Process: 17289 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
44
+ Main PID: 17375 (code=exited, status=1/FAILURE)
45
+ Status: "Server startup in progress"
46
+ Error: 13 (Permission denied)
47
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld_pre_systemd[17289]: 2021-0...
48
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld_pre_systemd[17289]: 2021-0...
49
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
50
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
51
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
52
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
53
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: mysqld.service: main ...
54
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: Failed to start MySQL...
55
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: Unit mysqld.service e...
56
+ Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: mysqld.service failed.
57
+ Hint: Some lines were ellipsized, use -l to show in full.
41
58
 
59
+
60
+
61
+ となったので、
62
+ [この記事](https://qiita.com/miriwo/items/e7afd5e1ae0de94f27c2)を参考に起動ログを確認
42
63
  ```php
43
- sudo systemctl status mysql
64
+ sudo vi /var/log/mysqld.log
44
65
  ```
66
+ > 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
67
+ 2021-02-06T04:19:01.655447Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
68
+ 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.
45
- > Unit mysql.service could not be found.
69
+ 2021-02-06T04:19:01.655552Z 0 [ERROR] [MY-010119] [Server] Aborting
70
+ 2021-02-06T04:19:01.655679Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
46
71
 
72
+
73
+ /var/lib/mysql/が使用できないと書かれているようなので、下記コマンドで削除してもう一度試してみても変わりなしです。。
47
74
  ```php
48
- $ mysql --version
75
+ sudo rm -rf /var/lib/mysql
49
76
  ```
50
- > mysql Ver 8.0.23 for Linux on x86_64 (MySQL Community Server - GPL)
51
77
 
78
+
52
79
  ```php
53
- yum list installed mysql*
80
+ less /var/log/mysqld.log
54
81
  ```
82
+ > 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
55
- > Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
83
+ 2021-02-06T02:57:16.558684Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
84
+ 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.
56
- 263 packages excluded due to repository priority protections
85
+ 2021-02-06T02:57:16.558771Z 0 [ERROR] [MY-010119] [Server] Aborting
57
- Installed Packages
58
- mysql-community-client.x86_64 8.0.23-1.el7 @mysql80-community
59
- mysql-community-client-plugins.x86_64 8.0.23-1.el7 @mysql80-community
60
- mysql-community-common.x86_64 8.0.23-1.el7 @mysql80-community
61
- mysql-community-devel.x86_64 8.0.23-1.el7 @mysql80-community
62
- mysql-community-libs.x86_64 8.0.23-1.el7 @mysql80-community
86
+ 2021-02-06T02:57:16.558895Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
63
- mysql80-community-release.noarch el7-3 installed
64
87
 
88
+ やはり/var/lib/mysql/についてのエラーが出るので/var/libからmysqlを削除してみて
89
+ 削除できたことを確認後、もう一度実行しましたが同じエラーになったので起動ログをみてみましたが変わりなしです。
90
+
91
+
92
+
93
+ ### その他試してみたこと
65
94
  ```php
66
- sudo systemctl status mysql
95
+ $ journalctl -xe
67
96
  ```
68
- > Unit mysql.service could not be found.
97
+ > -- Unit mysqld.service has begun starting up.
98
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.277076Z 0 [System] [MY-010116]
99
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.279385Z 0 [ERROR] [MY-010187] [
100
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.280569Z 0 [ERROR] [MY-010119] [
101
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.280726Z 0 [System] [MY-010910]
102
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal sudo[21540]: pam_unix(sudo:session): session closed for user root
103
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: mysqld.service: main process exited, code=exited, stat
104
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: Failed to start MySQL Server.
105
+ -- Subject: Unit mysqld.service has failed
106
+ -- Defined-By: systemd
107
+ -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
108
+ --
109
+ -- Unit mysqld.service has failed.
110
+ --
111
+ -- The result is failed.
112
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: Unit mysqld.service entered failed state.
113
+ Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: mysqld.service failed.
69
114
 
70
- どの情報が手がかりとなるがわかっていないため
71
- 大変わかりにくい部分もあるかと思いますがお力沿いいただきたく存じます????????‍♀️
72
115
 
116
+ この他にもエラーを元に様々なブログを読みは試しを繰り返しましたが、お手上げ状態です、、
117
+
73
- ここまで読んでさりありがとうございました
118
+ ここまで読んでいたありがとうございました
74
- よろしくお願ます????????‍♀️????????‍♀️
119
+ ご回答いただけますと幸いですm(_ _)m