Accessing the Database Through Sequel Pro and SSH
Why Use Sequel Pro?
Sequel Pro is an open-source macOS application that simplifies MySQL database management. With Sequel Pro, you can navigate databases, run queries, add/remove users, and perform other database management tasks through a secure SSH connection.
Download and Install Sequel Pro
- Visit Sequel Pro and download the application.
- Install and open Sequel Pro.
Setting Up an SSH Connection in Sequel Pro
To connect to your MySQL database using SSH:
-
Open Sequel Pro.
-
Create a New Connection:
- Click the Standard tab and then switch to the SSH tab.
-
Enter Connection Details:
- MySQL Host:
127.0.0.1
- Username:
root
- Password: Retrieve the MySQL root password from your server:
cat /root/.digitalocean_password
- Database: Leave blank to view all databases.
- MySQL Host:
-
SSH Details:
- SSH Host: Your server’s IP address.
- SSH User:
root
or another SSH user. - SSH Key: Select the private key file you created earlier, or enter the SSH password.
-
Save and Connect:
- Click Connect to establish the connection.
Navigating Your Database
Once connected, Sequel Pro provides a GUI to manage your database:
- View Tables: Browse database tables and their data.
- Run Queries: Execute SQL queries in the query editor.
- Manage Users: Add or remove database users and permissions.
- Export/Import Data: Export database schemas or import SQL files.
!!!CAUTION: Be careful when modifying your database. Changes are immediate and could affect your site’s functionality.
Tips for Secure Access
- Use an SSH key for authentication instead of passwords.
- Regularly back up your database before making changes.
- Limit access to the MySQL root account; use a user with restricted permissions for everyday tasks.
By following these steps, you can securely manage your MySQL database with Sequel Pro and SSH on DigitalOcean.