実現したいこと
aws初心者
cloud9にmysqlをインストールし、mysqlを使える環境で開発をしたい。
・
現状
容量が足りておらずサーバーをインストールできていなかったようなので
容量を追加し、サーバーがインストールできました。
php
1$ sudo yum install mysql-server
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
263 packages excluded due to repository priority protections
Package mysql-community-server-8.0.23-1.el7.x86_64 already installed and latest version
Nothing to do
php
1$ mysql --version
mysql Ver 8.0.23 for Linux on x86_64 (MySQL Community Server - GPL)
発生している問題
php
1$ systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2021-02-06 04:37:47 UTC; 13s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 17375 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 17289 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 17375 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 13 (Permission denied)
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld_pre_systemd[17289]: 2021-0...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld_pre_systemd[17289]: 2021-0...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal mysqld[17375]: 2021-02-06T04:37:4...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: mysqld.service: main ...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: Failed to start MySQL...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: Unit mysqld.service e...
Feb 06 04:37:47 ip-172-31-37-66.ap-southeast-1.compute.internal systemd[1]: mysqld.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
となったので、
この記事を参考に起動ログを確認
php
1sudo vi /var/log/mysqld.log
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
2021-02-06T04:19:01.655447Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
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.
2021-02-06T04:19:01.655552Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-02-06T04:19:01.655679Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
/var/lib/mysql/が使用できないと書かれているようなので、下記コマンドで削除してもう一度試してみても変わりなしです。。
php
1sudo rm -rf /var/lib/mysql
php
1less /var/log/mysqld.log
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
2021-02-06T02:57:16.558684Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
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.
2021-02-06T02:57:16.558771Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-02-06T02:57:16.558895Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
やはり/var/lib/mysql/についてのエラーが出るので/var/libからmysqlを削除してみて
削除できたことを確認後、もう一度実行しましたが同じエラーになったので起動ログをみてみましたが変わりなしです。
その他試してみたこと
php
1$ journalctl -xe
-- Unit mysqld.service has begun starting up.
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.277076Z 0 [System] [MY-010116]
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.279385Z 0 [ERROR] [MY-010187] [
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.280569Z 0 [ERROR] [MY-010119] [
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal mysqld[21612]: 2021-02-06T05:43:35.280726Z 0 [System] [MY-010910]
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal sudo[21540]: pam_unix(sudo:session): session closed for user root
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: mysqld.service: main process exited, code=exited, stat
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mysqld.service has failed.
-- The result is failed.
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: Unit mysqld.service entered failed state.
Feb 06 05:43:35 ip-xxx.ap-southeast-1.compute.internal systemd[1]: mysqld.service failed.
この他にもエラーを元に様々なブログを読みは試しを繰り返しましたが、お手上げ状態です、、
ここまで読んでいただきありがとうございました。
ご回答いただけますと幸いですm(_ _)m
回答2件
あなたの回答
tips
プレビュー