- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
Hello.
I think you were probably connecting to the database using EC2 or something rather than within CloudShell.
Also, do you have RDS within your AWS account?
If you can confirm that the instance exists in the RDS console, you can check the host option of the "mysql" command.
Also, if you can find an RDS instance, you can change the password by following the steps in the document below.
https://repost.aws/knowledge-center/reset-master-user-password-rds
As @Riku_Kobayashi has already said, the file /var/www/html/application/settings/database.php
is almost certainly not in CloudShell but more likely in an EC2 instance (this is basically a VM in the cloud).
I notice that your CloudShell link & screengrab are for the AWS Region ap-northeast-1 (Tokyo) but the RDS link in the text is ap-southeast-2 (Sydney). Usually you would expect resources to be provisioned in the same region, and for this to be geographically close to your location. Which would this be for you?
If there is an EC2 instance running in this account anywhere in the world you should be able to identify it in EC2 Global View https://console.aws.amazon.com/ec2globalview/home#
Once you find it then navigate to the region in which it is running https://docs.aws.amazon.com/awsconsolehelpdocs/latest/gsg/select-region.html
Depending on the AMI it's built with you may be able to connect to it using EC2 Instance Connect https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-methods.html
Or Session Manager https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/session-manager-to-linux.html
From here you can display the contents of the database.php
file (check beforehand it is an ASCII text file).
ls -l /var/www/html/application/settings/database.php
file /var/www/html/application/settings/database.php
cat /var/www/html/application/settings/database.php
And it would be a fair assumption that whichever region this EC2 is in, the RDS database is likely to be in the same one.
Many thanks, Gary, Riku & Steve!
Yes, I am attempting to get support from the developer, but it's proving difficult. Riku's suggestion to access EC2 Global View was helpful, and it shows an instance: Clicking through to the instance details and "Connect" I get the following, in the Ohio region: However, I can't follow the path "/var/www/html " >> "application/settings/" >> "database.php" >. I'm not sure where to take it from there. thank you for getting me this far!
Typing
/var/www/html/application/settings/database.php
by itself will cause the shell to try and run it (which it almost certainly can't).Verify that the file exists:
ls -l /var/www/html/application/settings/database.php
Verify the file type:
file /var/www/html/application/settings/database.php
If it's ASCII text then display the contents:
cat /var/www/html/application/settings/database.php
And separate to EC2, do you see any RDS databases in Ohio? https://us-east-2.console.aws.amazon.com/rds/home?region=us-east-2#
Hi, Steve_M. Thank you for the advice.
Following the steps you suggested I can get this far:
Everything in Ohio shows up as 0.
Okay so the host is localhost, which suggests the database is running locally on this EC2 instance, and not in RDS.
Check that MySQL is running and listening on the default port
sudo netstat -tulpn | grep -w 3306
If it is then try to connect, plugging in the parameters from
database.php
into themysql
command that's in your original question.More info on the Ubuntu
mysql
command is here https://manpages.ubuntu.com/manpages/trusty/man1/mysql.1.htmlI got caught up with other things and still haven't resolved this.
I entered sudo netstat -tulpn | grep -w 3306 at the Ubuntu search prompt, but the response was "command not found". Entering mysql got the response "Access denied for user 'ubuntu' @ 'localhost' (using password: NO)'. I feel I'm getting closer, but still not quite there!
Thank you for your reply. Unfortunately, I am not familiar with the technology and the terms you are using (EC2, RDS...). I am attempting to enter commands here: https://ap-northeast-1.console.aws.amazon.com/cloudshell/home?region=ap-northeast-1#1657521f-ffb3-482e-b3c6-3dcc5d06ffc0. I log in and enter /var/www/html/application/settings/database.php, but it doesn't work.
I successfully accessed the database about a year ago, but have been drawn away from this project by other things and on coming back to it I can't make it work.
On thing, though; the database link (https://ap-southeast-2.console.aws.amazon.com/rds/home?region=ap-southeast-2#) says there are no instances of any database. This is odd, because the site itself is performing as normal, including material which I believe is inside at least one database.
I'm attempting to get support from the people who set this up initially, but it's proving difficult.
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 2 Jahren
- AWS OFFICIALAktualisiert vor 2 Jahren
Was it possible to connect to the database with CloudShell a year ago? By the way, data in CloudShell will be deleted 120 days after it was last accessed, so if it has not been accessed for a long time, the php file "database.php" may have disappeared. https://docs.aws.amazon.com/cloudshell/latest/userguide/limits.html
Also, are you viewing the correct region? RDS is a regional resource and may be found if you open another region. https://docs.aws.amazon.com/awsconsolehelpdocs/latest/gsg/select-region.html
It is also possible that the database is in an instance such as EC2 or Lightsail that hosts the website without using RDS. Please check whether EC2 or Lightsail exists in your AWS account. Can you find the file by running the command below? If it cannot be found, the CloudShell data may have disappeared or the CloudShell region may be incorrect.
It's probably best to contact the person who created the project directly, as further information may not be available on re:Post.