前提・実現したいこと
AWS EC2にインストールしたMySQLが起動したい
AWSでのRailsアプリのデプロイを試みています。
発生している問題・エラーメッセージ
以下のコマンドで起動を試みましたが、ユニットがないと言われてしまっています。
$ sudo service mysqld start Redirecting to /bin/systemctl start mysqld.service Failed to start mysqld.service: Unit not found.
$ sudo systemctl start mysqld.service Failed to start mysqld.service: Unit not found.
試したこと
以下のようにmysqlはインストールされているようです。
$ yum list installed | grep mysql mysql-community-client.x86_64 5.6.47-2.el6 @mysql56-community mysql-community-common.x86_64 5.6.47-2.el6 @mysql56-community mysql-community-devel.x86_64 5.6.47-2.el6 @mysql56-community mysql-community-libs.x86_64 5.6.47-2.el6 @mysql56-community mysql-community-release.noarch el6-5 installed
またデータベースも作成されているように見えます。
$ mysql -h RDSエンドポイント -P 3306 -u マスターユーザー名 -p $ show databases; +---------------------+ | Database | +---------------------+ | information_schema | | innodb | | mysql | | performance_schema | | sys | | アプリ名 | +---------------------+
もしかしてUnit Not Foundの理由はデータベースへアクセスできないからでしょうか。
参考のためvim config/database.yml
の中身を貼ります。
# MySQL. Versions 5.0 and up are supported. # # Install the MySQL driver # gem install mysql2 # # Ensure the MySQL gem is defined in your Gemfile # gem 'mysql2' # # And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.7/en/old-client.html # default: &default adapter: mysql2 encoding: utf8 pool: 5 username: root password: password host: db development: <<: *default database: app_development # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: app_test # As with config/secrets.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # # Instead, provide the password as a unix environment variable when you boot # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full rundown on how to provide these environment variables in a # production deployment. # # On Heroku and other platform providers, you may have a full connection URL # available as an environment variable. For example: # # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase" # # You can use this database configuration with: # # production: # url: <%= ENV['DATABASE_URL'] %> # production: <<: *default adapter: mysql2 encoding: utf8 database: RDS DB名 username: マスターユーザー名 password: パスワード host: エンドポイント port: 3306
すみませんがアドバイスをお願いします。
追記:
$ sudo yum install mysql mysql-devel mysql-server mysql-utilities Loaded plugins: extras_suggestions, langpacks, priorities, update-motd 31 packages excluded due to repository priority protections Resolving Dependencies --> Running transaction check ---> Package mysql-community-client.x86_64 0:5.6.47-2.el6 will be installed --> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.47-2.el6.x86_64 --> Processing Dependency: libtinfo.so.5()(64bit) for package: mysql-community-client-5.6.47-2.el6.x86_64 --> Processing Dependency: libncurses.so.5()(64bit) for package: mysql-community-client-5.6.47-2.el6.x86_64 ---> Package mysql-community-devel.x86_64 0:5.6.47-2.el6 will be installed ---> Package mysql-community-server.x86_64 0:5.6.47-2.el6 will be installed --> Processing Dependency: mysql-community-common(x86-64) = 5.6.47-2.el6 for package: mysql-community-server-5.6.47-2.el6.x86_64 --> Processing Dependency: perl(Data::Dumper) for package: mysql-community-server-5.6.47-2.el6.x86_64 --> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.47-2.el6.x86_64 ---> Package mysql-utilities.noarch 0:1.6.5-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-utilities-1.6.5-1.el6.noarch --> Processing Dependency: mysql-connector-python >= 2.0.0 for package: mysql-utilities-1.6.5-1.el6.noarch --> Running transaction check ---> Package mariadb-libs.x86_64 1:5.5.64-1.amzn2 will be obsoleted ---> Package mysql-community-common.x86_64 0:5.6.47-2.el6 will be installed ---> Package mysql-community-libs.x86_64 0:5.6.47-2.el6 will be obsoleting ---> Package mysql-connector-python.x86_64 0:2.1.7-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-connector-python-2.1.7-1.el6.x86_64 ---> Package mysql-utilities.noarch 0:1.6.5-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-utilities-1.6.5-1.el6.noarch ---> Package ncurses-compat-libs.x86_64 0:6.0-8.20170212.amzn2.1.3 will be installed ---> Package perl-DBI.x86_64 0:1.627-4.amzn2.0.2 will be installed --> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.amzn2.0.2.x86_64 --> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.amzn2.0.2.x86_64 ---> Package perl-Data-Dumper.x86_64 0:2.145-3.amzn2.0.2 will be installed --> Running transaction check ---> Package mysql-connector-python.x86_64 0:2.1.7-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-connector-python-2.1.7-1.el6.x86_64 ---> Package mysql-utilities.noarch 0:1.6.5-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-utilities-1.6.5-1.el6.noarch ---> Package perl-PlRPC.noarch 0:0.2020-14.amzn2 will be installed --> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.amzn2.noarch --> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.amzn2.noarch --> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.amzn2.noarch --> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.amzn2.noarch --> Running transaction check ---> Package mysql-connector-python.x86_64 0:2.1.7-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-connector-python-2.1.7-1.el6.x86_64 ---> Package mysql-utilities.noarch 0:1.6.5-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-utilities-1.6.5-1.el6.noarch ---> Package perl-IO-Compress.noarch 0:2.061-2.amzn2 will be installed --> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.amzn2.noarch --> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.amzn2.noarch ---> Package perl-Net-Daemon.noarch 0:0.48-5.amzn2 will be installed --> Running transaction check ---> Package mysql-connector-python.x86_64 0:2.1.7-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-connector-python-2.1.7-1.el6.x86_64 ---> Package mysql-utilities.noarch 0:1.6.5-1.el6 will be installed --> Processing Dependency: python(abi) = 2.6 for package: mysql-utilities-1.6.5-1.el6.noarch ---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.amzn2.0.2 will be installed ---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.amzn2.0.2 will be installed --> Finished Dependency Resolution Error: Package: mysql-utilities-1.6.5-1.el6.noarch (mysql-tools-community) Requires: python(abi) = 2.6 Installed: python-2.7.16-5.amzn2.x86_64 (installed) python(abi) = 2.7 python(abi) = 2.7 Available: python-2.7.5-58.amzn2.x86_64 (amzn2-core) python(abi) = 2.7 python(abi) = 2.7 (中略) Error: Package: mysql-connector-python-2.1.7-1.el6.x86_64 (mysql-connectors-community) Requires: python(abi) = 2.6 Installed: python-2.7.16-5.amzn2.x86_64 (installed) python(abi) = 2.7 python(abi) = 2.7 Available: python-2.7.5-58.amzn2.x86_64 (amzn2-core) python(abi) = 2.7 python(abi) = 2.7 (中略) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
回答1件
あなたの回答
tips
プレビュー