This post describes how to deploy the demo project (PHP + MySQL) to a VPS manually: export the database from your local machine, create a new database on the VPS, import via phpMyAdmin, upload the source code, and important notes on running migrations and syncing new posts from local to VPS.
1. Prepare locally
Ensure the project runs locally (MAMP/XAMPP) with data and config/database.local.php set.
2. Export database (Terminal)
mysqldump -h 127.0.0.1 -u myapp -pmyapp123 myapp > ~/Desktop/myapp_backup.sql
Or export only the posts table for lighter sync:
mysqldump -h 127.0.0.1 -u myapp -pmyapp123 myapp posts > ~/Desktop/myapp_posts.sql
3. Create database on VPS
sudo mysql -u root -e \"CREATE DATABASE IF NOT EXISTS myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'strong_password'; GRANT ALL ON myapp.* TO 'myapp_user'@'localhost'; FLUSH PRIVILEGES;\"
4. Import via phpMyAdmin
Upload the .sql file to the VPS, open phpMyAdmin, select the myapp database, use Import, choose the file, and run. Full backup restores all tables; posts-only file restores only the posts table (other tables must exist from schema/migration).
5. Upload source code
Use SFTP/SCP or FileZilla to upload the project to e.g. /var/www/myapp. Set ownership: sudo chown -R www-data:www-data /var/www/myapp and chmod -R 775 data/.
6. Configure on VPS
Create config/database.local.php with the VPS DB credentials. Point Nginx/Apache document root to the project folder and enable PHP.
7. Run migration
cd /var/www/myapp
php install/migrate.php
Migrations run only once (tracked in schema_migrations). Prefer CLI over browser for production.
8. Syncing new posts from local to VPS
Posts live in the database. To bring new local posts to VPS: export the posts table from local, upload the .sql file, then import into the VPS database. A full table export/import replaces all posts on VPS; use INSERT IGNORE or partial export if you need to merge without losing VPS-only posts.
9. Summary
Manual deploy: export DB → create DB and user on VPS → import via phpMyAdmin → upload code → set config and run migrate.php. For new posts: export posts (or full DB) from local and import on VPS.