So I figured it out. If anyone comes across this issue try the following.
AWS Lightsail gives you 2 IP's
- Static IP = 34.xxx.xxx.xxx
- Private IP = 172.xx.xx.xx
In your etc/mysql/mysql.conf.d/mysqld.cnf
file do the following:
# bind-address = 127.0.0.1 (Disable this)
# bind-address = 34.xxx.xxx.xxx (Don't use Static IP)
bind-address = 172.xx.xx.xx (Use Private IP)
In AWS Lightsail Firewall Add MySQL/Aurora | TCP | 3306
Run the following commands on server:
sudo service mysql stop
sudo service mysql start
Connecting With DB Client:
- Host/Socket = 34.xxx.xxx.xxx (Use Static IP)
- Port 3306
- User: admin (Your created user account (See below how to do this))
- Password your_new_pass_here (Your created password)
- Database: mydatabase (Your created DB name)
That's it. All should work now.
As mentioned below, you do need to create a new MySql User. You can do so like this:
- Create DB User so we can remote into it from local machine/ database
client:
mysql -u root -p'' (Login to MySql with the credentials you used to create MySql, -u might be different)
2.
CREATE USER 'admin'@'34.xxx.xxx.xxx' IDENTIFIED BY 'your_new_pass_here';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'34.xxx.xxx.xxx' IDENTIFIED BY 'your_new_pass_here';
CREATE USER 'admin'@'%' IDENTIFIED BY 'your_new_pass_here';
GRANT ALL PRIVILEGES ON *.* TO 'admin' IDENTIFIED BY 'your_new_pass_here';
3.
FLUSH PRIVILEGES;
- Bind Address
To get Database working remotely go to /etc/mysql/mysql.conf/mysqld.cnf
and change the bind-address:
# bind-address = 127.0.0.1 (Disable this)
# bind-address = 34.xxx.xxx.xxx (Don't use Static IP)
bind-address = 172.xx.xx.xx (Use Private IP)
- exit
service mysql restart
(Add to new .env if using Laravel)
DB_CONNECTION=mysql
DB_HOST=34.xxx.xxx.xxx
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=admin
DB_PASSWORD=your_new_pass_here
If you need to get a list of your MySql User do this:
SELECT User FROM mysql.user;
Helpful to double check your new user is in the system.
Bitnami Engineer here,
We configure the permissions of the WordPress' files by setting bitnami
as the user owner and daemon
as group owner of the files. However, if you make changes to the application using the web interface (install plugins or themes), those new files are owned by daemon:daemon (the Apache and PHP-FPM services use that user and group so they generate the files using those permissions configuration). In that case, you can run the following commands to be able to edit those files using the bitnami user
sudo chown -R /opt/bitnami/apps/wordpress/htdocs
sudo find /opt/bitnami/apps/wordpress/htdocs -type d -exec chmod 775 {} \;
sudo find /opt/bitnami/apps/wordpress/htdocs -type f -exec chmod 664 {} \;
sudo chmod 640 /opt/bitnami/apps/wordpress/htdocs/wp-config.php
You can learn more about this here
https://www.youtube.com/watch?list=PLGgVZHi3XQNn4x0DU7Qj1r_inej3xEUda&v=nKfle7O0vN8&feature=emb_title
Best Answer
Bitnami Engineer here,
No, the Bitnami WordPress solution in Lightsail is a SingleVM deployment where Apache, PHP and MySQL are included inside the same instance.
We configure the database (create a new user and database for WordPress) and configure the application to use it. It has basic information about the WordPress' admin user when you deploy it. Of course, you can configure WordPress to use a separate MySQL database.
You can create a WordPress backup easily by using the All in One Migration plugin. Once you install it, you can import/export the data in a few clicks
https://docs.bitnami.com/aws/how-to/migrate-wordpress/
If you create a snapshot of the instance, and as all the components are included in the same instance, you don't need to take any other backup to save your data. Once you deploy the snapshot you create, the information will be the same than the one you had when creating it.
WordPress is configured to use MySQL by default. It uses the local database but as I mentioned before, you can use an external database if needed. You just need to change the WordPress configuration at /opt/bitnami/apps/wordpress/htdocs/wp-config.php.
If you want to deploy different WordPress apps on top of the same instance, you will need to follow these steps. These steps assume that your application will live in the /opt/bitnami/apps/myapp/ directory:
1) Run the following commands to create the directories and assign the necessary permissions:
2) Create and edit the /opt/bitnami/apps/myapp/conf/httpd-prefix.conf file and add the line below to it:
3) Create and edit the /opt/bitnami/apps/myapp/conf/httpd-app.conf file and add the content below to it. This is the main configuration file for your application, so modify it further depending on your application’s requirements.
4) Once you have created the files and directories above, add the following line to the end of the main Apache configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf, as shown below:
5) Restart the Apache server:
You should now be able to access the application at http://SERVER-IP/myapp.
More information here: https://docs.bitnami.com/aws/apps/wordpress/administration/create-custom-application-php/
The Bitnami solution doesn't use the system's packages. All the services are inside the /opt/bitnami folder so I don't know if cpanel supports that. We do not provide support for it by the way.