Rocky Linux 10 LTS | Production-Ready | Auto-Tuning
Complete AMI guide for your MySQL 8.4 + phpMyAdmin. Learn how to access your database, find credentials, and configure your instance for production use.
Follow these steps to access your MySQL database and phpMyAdmin web interface.
Connect to your EC2 instance using SSH with your key pair.
ssh -i your-key.pem ec2-user@<your-instance-ip>
View the auto-generated MySQL and phpMyAdmin passwords.
sudo cat /root/.mysql_credentials
Open phpMyAdmin in your browser using your instance's public IP.
http://<your-instance-ip>/phpmyadmin
Login with:
Username: root
Password: (from credentials file)
Connect via command line or add a server in phpMyAdmin.
# On the instance:
mysql -u root -p
# From remote:
mysql -h <your-instance-ip> -u root -p
All credentials are automatically generated and stored securely on your instance.
sudo cat /root/.mysql_credentials
mysql://root:<password>@<your-instance-ip>:3306/mysql?ssl-mode=REQUIRED
phpMyAdmin is a powerful web-based administration tool for MySQL. Here's how to get started.
Open your browser and navigate to the phpMyAdmin URL.
http://<your-instance-ip>/phpmyadmin
Username: root
Password: (from credentials file)
Create a new database for your application.
utf8mb4_unicode_ci collationUse the SQL tab to execute SQL commands.
Create application-specific database users.
% for remote accessSelect database → Create table
Define columns, types, indexes, and constraints.
Select database → Import tab
Upload SQL, CSV, or other supported formats.
Select database → Export tab
Choose SQL format for full backup.
Click User accounts tab
Add, modify, or remove database users.
Select table → Browse tab
View, edit, and delete rows directly.
Click Status tab
Monitor connections, queries, and performance.
Follow these steps to secure your MySQL deployment.
Important: Change the default passwords immediately after your first login. The pre-generated passwords should only be used for initial access.
Update MySQL root password via command line or phpMyAdmin interface.
Restrict port 3306 access to only your IP addresses or VPC CIDR range.
SSL is enabled by default. All connections use TLS encryption.
mysql -u root -p -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'your-new-secure-password';"
Common issues and how to resolve them.
Symptom: Connection refused or timeout when connecting from your machine.
Solution:
3306sudo systemctl status mysqldSymptom: Can't log in to phpMyAdmin web interface.
Solution:
sudo cat /root/.mysql_credentialssudo systemctl status httpdsudo systemctl restart httpd mysqlSymptom: phpMyAdmin shows a blank white page.
Solution:
sudo tail -50 /var/log/httpd/error.logphp -vsudo systemctl restart httpdSymptom: "Access denied for user 'root'@'localhost'"
Solution:
sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';"FLUSH PRIVILEGES;Common questions and quick solutions.
sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';"
sudo tail -100 /var/log/mysql/error.log
sudo systemctl restart mysqld
sudo systemctl restart httpd
Data is stored on a separate EBS volume:
/var/lib/mysql
sudo systemctl status mysqld httpd
Choose the right EC2 instance type for your workload.
| Use Case | Instance Type | vCPUs | RAM | Recommended For |
|---|---|---|---|---|
| Development | t3.small |
2 | 2 GB | Testing, learning, small dev projects |
| Small Production | t3.medium |
2 | 4 GB | Small apps, low traffic websites |
| Medium Production | m6i.large |
2 | 8 GB | Medium traffic, business applications |
| Large Production | m6i.xlarge |
4 | 16 GB | High traffic, enterprise workloads |
| High Performance | r6i.xlarge |
4 | 32 GB | Memory-intensive, analytics, large datasets |
Protect your data with regular backups.
The easiest way to back up your entire database.
Export databases to SQL files.
# Backup single database
mysqldump -u root -p mydb > mydb_backup.sql
# Backup all databases
mysqldump -u root -p --all-databases > all_databases.sql
# Compressed backup
mysqldump -u root -p mydb | gzip > mydb.sql.gz
Restore databases from SQL files.
# Restore from SQL
mysql -u root -p mydb < mydb_backup.sql
# Restore from compressed
gunzip < mydb.sql.gz | mysql -u root -p mydb
# Create db and restore
mysql -u root -p -e "CREATE DATABASE newdb;"
mysql -u root -p newdb < mydb_backup.sql
Recommended backup frequency:
MySQL is automatically configured based on your instance size.
On first boot, the auto-tuning service detects your instance's RAM and CPU count, then calculates optimal MySQL settings.
Key configuration and log file locations:
Our team is available 24/7 to assist you with any questions or issues.
support@flowopsconsulting.co.uk