How to launch PhpMyAdmin or MySQL Workbench for an AWS Ec2 WordPress instance? - wordpress

I launched a WordPress instance in EC2 in AWS. Now I can access WordPress Dashboard. But how to access database? If I install WordPress in my PC I can easily access it via a local-host link. From AWS how can I access the same? Also, is there any possibility to connect the MySQL database via MySQL Workbench?
Thanks
Venkat

Venkata, you are able to access WordPress hosted on EC2 because the http port and https port is open in the firewall, check your inbound settings in security group.
You can access your MySQL Database hosted in same EC2 instance (in this specific case) if you can open the port for access, in inbound settings. Make sure you have a MySQL user created and you have user name and password for the user.

First On EC2 instance you have to configure complete LAMP stack and than you have to open the port from security groups from AWS console admin.
After installing LAMP stack and opening port you have to place adminer.php file on the /var/www/html directory or the directory where you installed the wordpress.
after that you can access the database and the wordpress

Related

MariaDB: root access from network means also from SSH?

During the securing of MariaDB it asks me the following question:
Disallow root login remotely? [Y/n]
Normally, root should only be allowed to connect from 'localhost'.
This ensures that someone cannot guess at the root password from the
network.
Because I'm working on a headless server (Ubuntu Server) without any screen nor keyboard, my only way to reach the o.s. is via SSH.
Disabling the remote root login will prevent me to access from SSH as well? I guess yes, and I kept the remote login enabled.
It's the default admin account of MariaDB, has same name with system root account, but there's no direct relationship between them. System user bob can also use command mysql -uroot -p to connect MariaDB with admin privilege.
login remotely means connecting to MariaDB remotely using port 3306. if remote login is enabled for root and MariaDB bind a public IP, anyone can try to connect to your DB by mysql -uroot -hIP. then a security incident happened if weak password used.
Disallow root login remotely? [Y/n]
That's from MariaDB perspective, NOT the SSH.
When you are login via SSH and then login to MariaDB via mysql cli to localhost server, MariaDB assume that you login "locally".
As like many other RDBMS, MariaDB allow to login remotely, in your case without SSH, to any remote server via TCP/IP. This kind of login to MariaDB is the meaning about above question.
Example:
You are now at Host A (IP: 192.168.0.10). The MariaDB server at Host B (IP: 192.168.0.11).
If you are accessing the MariaDB server via mysql client cli and execute:
mysql -h192.168.0.11 -uroot -p
That's called "root login remotely"

Can't Connect to RDS mysql DB from Wordpress on Ubuntu 18.04 EC2 Instance

I'm trying to run Wordpress on my Ec2 instance with RDS MySQL database.
Here's the tutorial I've followed https://cristianocastro.net/instalando-wordpress-em-um-servidor-amazon-aws-pt-2-3/
But when I try to access the Ec2 instance that connect to the RDS on the browser it shows this message
Error establishing a database connection
I put in the security group inbound and outbound all traffic anywhere.
Here's the print from my security group rule.
Appreciate the help
PS: Saw this question, with no anwser Can't Connect to RDS mysql DB from Wordpress on Amazon linux EC2 Instance
Edit: Rules from security group of the ec2 instance that will access RDS.
Based on the info you provided it seems your RDS is publicly accessible via the internet and connections are going to be accepted from any host (you might want to restrict these later)
Assuming that your software setup (OS, php, MySQL libraries, Wordpress) is okay and you’re using the right parameters in the WP configuration (host, port, user, password, db).
One of the remaining issues might be that the Security Group attached to your EC2 instance doesn’t allow connectivity on port 3306 (MySQL) towards the IP Address of your RDS instance.
It appears that you have:
An Amazon EC2 instance
An Amazon RDS instance
The typical security configuration would be:
The Amazon RDS database configured as Publicly Accessible = No
A Security Group (EC2-SG) on the Amazon EC2 instance that permits inbound traffic from your desired locations (eg port 22 for SSH), and default Outbound rules permitting all traffic outbound
A Security Group (RDS-SG) on the Amazon RDS database instance that permits inbound traffic on port 3306 from EC2-SG
That is, RDS-SG should specifically reference EC2-SG to permit the inbound connection.
The app running on the EC2 instance should reference the RDS database via the DNS Name shown in the RDS console.

How can I make mysql access public and not restricted only to localhost?

I'm trying to connect zapier to the mysql db installed with a bitnami wp site in aws, but it seems I cannot connect them if the access is only restricted to the localhost. Any idea on how to change this in order to make it work?
this is what my security group looks like:
https://pasteboard.co/HL2ALzP.png
this is what my registered targets look like:
https://pasteboard.co/HL2Aa1G.png
this is the info zapier asks for in order to connect:
https://pasteboard.co/HLa6HMC.png
WARNING: These instructions suppose an important security risk. I do not recommend to open your database to the public under any circumstances
You need to edit the /opt/bitnami/mysql/my.cnf and change
bind-address=127.0.0.1
to
bind-address=0.0.0.0
Then restart mysql
sudo /opt/bitnami/ctlscript.sh restart mysql
Apart from that, you will need to open your firewall port in AWS. Here you have a guide for that
https://docs.bitnami.com/aws/faq/administration/use-firewall/

What is the configuration for setting up MySQL workbench with a AWS Bitnami instance?

I am some issue with connecting the pipes between MySQL Workbench and my Bitnami Wordpress instance on AWS (using ssh). I have read and attempted the docs several times, I don't know what is going on.
I have successfully ssh-ed via the command line using ssh -i my_key_file bitnami#IP-Address.
However, I cannot get it to work for MySQL Workbench.
Field Value
SSH Hostname IP-Address
SSH Username bitnami
SSH Key File <path-to-key-file>
MySQL Hostname 127.0.0.1
MySQL Server Port 3306
MySQL username root
The path to key-file is correct as it works for other AWS instances. And the SSH hostname and SSH username get my access via the terminal - so I would assume these are fine?
When I test the connection, I am prompted for a password. Everywhere online suggests that this password is the admin password used the Wordpress account (accessible via the system logs). I have this password. However, this doesn't get me in.
The attempted connection returns the error: Failed to Connect to MySQL at 127.0.0.1:3306 through SSH tunnel at bitnami#IP-Address with user root
Any help would be appreciated
I have read and attempted the docs several times, I don't know what is going on.
I guess you are referring to this documentation
Could you try to reset the password for the root user as described in the guide below?
https://docs.bitnami.com/aws/components/mysql/#how-to-reset-the-mysql-root-password
Once you have restarted it and you have chosen a new one, use this new password on the Workbench.

woocommerce webhooks not firing

woocommerce webhooks aren't firing at all for me, even on a fresh install. I did the following:
Create a new MySQL database
Install WP from the zip file.
Set up WP.
Install Woocommerce.
Enable REST API and create a key.
Added "Coupon created" webhook, made sure it's set to active, and set it to a publicly accessible site.
When I create a coupon, the webhook does not fire, and no entry is created in the log. I tried this with orders as well and also doesn't work.
I think it's a machine configuration problem, but not sure what to change. The machine is an EC2 instance and has all ports opened in its security group policy.
Weirdest of all is that on a different EC2 instance does work, but it's a production machine and I want to have a dev server work so I can test out things. The only config differences between the production and dev machines that I can think of are the subnets and the firewall, but I don't understand why the subnet should matter and I opened all the firewall ports on the dev machine.
what Linux distributions are you running for prod and dev?
CentOS with SELinux enabled with not allow HTTPD scripts and modules to connect to network by default.
setsebool -P httpd_can_network_connect on
If above is not valid, please identify network problems by trying connecting to AWS RDS via SSH CLI. If you can open a connection via SSH CLI, the problem will be with your application. If you can't, it will be network problem. First thing to check in that case is AWS RDS security group. For testing you can open 3306 to public.
Let me know how it goes.

Resources