I'm still new to AWS and this is my first attempt at working with MariaDB; I'm used to dealing with hosting providers that already have something like cPanel installed so please be nice. :)
I'm using Bitnami's WordPress Multi-Tier with Amazon RDS for MariaDB
Bitnami's documentation is usually quite good, but in this particular case I'm not finding anything. I've reached out to their support and the only reply I've received until now was something akin to: "use a WordPress plugin to make database exports" which is obviously isn't going to cut the mustard when it comes to importing.
What I want to accomplish:
Connect to my database
Export my database
Import (overwrite) a database
Essentially, I want to deploy my local WordPress to AWS...files are all good, but I'm lost when it comes to databases.
(NOTE: I want to get out of the habit of relying on phpMyAdmin and, ideally, don't want to have to go through installing it, etc)
I started here: [Connecting to a DB Instance Running the MariaDB Database Engine][2]
After SSH'ing in I've tried:
Command: mysql
Outputs: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (2)
Command: mysql -h MY-DB-INSTANCE.us-east-1.rds.amazonaws.com -P 3306 -u bitnami
Outputs: Access denied for user 'bitnami'#'10.0.4.110' (using password: NO)
EDIT: I've split this thread into a separate one for other issues that I ran into.
Presumably your MySQL user bitnami actually has a password, so you may try this:
mysql -h MY-DB-INSTNACE.us-east-1.rds.amazonaws.com -P 3306 -u bitnami -p
^^^ add this
Your shell should prompt you for the password.
Beyond this, you need to make sure that you have opened your RDS instance to the IP from which you are trying to connect. You could open it to all IPs, but it is better practice to just open it to your dev machine, as well as the production machines which would be hitting the database. If you don't do this step, you also would not be able to connect.
Edit: If your user bitnami does not yet exist, then you may have to login as root and configure. Or perhaps you would have to reset the password if forgotten. You should always write down the admin credentials, as a last resort means of accessing your RDS instance.
Related
I am trying to get the databases backed up from a local machine to a datastore. The local machine is a VM within VCenter and I need the DB to go onto one of it's datastores.
I know the command for MySQLDump is:
mysqldump -u (username) -p --all-databases > (backupfilename).sql.
What do I put in the second section to get it to connect and push the backup to the datastore as a file?
I tried the typical stuff you'd scp and rsync for but I'm not that versed in MariaDB, especially this version we have.
If you know login credentials and hostname (and whatever extra arguments you need) to connect to remote instance, you may replace > backupfilename.sql with | mysql -U user -P password -H host .... to pipe mysqldump directly or even use | tee somefile.sql | mysql .... to also have a local dump.
Mariadb vs mysql is almost inerchangeable, but dont bet your life on this assumption - check the outcome.
Nb: if remote server is only listening locally and not available via internet, you may use ssh port forwarding/socket forwarding to connect.
I deployed wordpress site on EC2 and connected it using RDS mysql. Everything works perfect on the first run and as long as EC2 and RDS are running. As soon as i stop the ec2 and rds and try to reboot it next morning or straight away, i can get to word press site but content is not layed out properly and images are missing too. I searched through internet and found closely related issues which recommend using of elastic ip, i also used elastic ip and assign that to EC2 but still content of WP is missing. Any suggestion
Wordpress is embedding your website URL, or IP address if you don’t have a stable DNS name, in its configuration file and database.
Any change of the IP addrsss or DNS name after the initial installation will cause the behavior you’re seeing.
This page doc has the steps to fix that. https://codex.wordpress.org/Changing_The_Site_URL
The below script directly changes the IP address in the Wordpress database. Be sure to change DB_NAME, DB_USER and DB_PASSWORD
#!/bin/bash
DB_HOSTNAME=`grep DB_HOST /var/www/html/wordpress/wp-config.php | cut -d ',' -f2 | awk -F "'" '{ print $2 }'`
WP_URL="http://`curl http://169.254.169.254/latest/meta-data/public-hostname/`/wordpress"
DB_USER=wordpress
DB_PWD=password
DB_NAME=wordpress
mysql -u $DB_USER --password=$DB_PWD -h $DB_HOSTNAME $DB_NAME -e "UPDATE wp_options SET option_value='$WP_URL' WHERE option_name='siteurl' OR option_name='home'"
You can run this script automatically at boot time to adjust the DB to the new IP address of the EC2 instance.
Note that the long term solution is different : I would recommend to use two EC2 instances for availability and a load balancer. The load balancer will have a stable DNS name (that you can alias with a CNAME record in your domain DNS). The Wordpress database would include that CNAME name only.
See this whitepaper for best practices to deploy Wordpress on AWS : https://aws.amazon.com/blogs/architecture/wordpress-best-practices-on-aws/
I also faced same issue, when i installed wordpress on aws ec2 instance, i have created some posts and pages, and after some time i have stopped ec2 instance. When started ec2 instance, wordpress site did not showing contents.
So the Solution was i found is that, wordpress require static IP address, so i have created new ec2, assigned Elastic IP address to the ec2 instance and created wordpress blog, it worked fine for me even restarting the ec2 multiple times.
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/
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 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.