DDEV Laravel Project Setup
January 23, 2025 ยท AI Conversations
1. **Project Name**: `shareyourthoughts`
2. **URLs**:
– Project URL: [https://shareyourthoughts.ddev.site](https://shareyourthoughts.ddev.site)
– Docker-mapped ports for web (HTTP/HTTPS) and database (MariaDB).
3. **Services**:
– Web service running Laravel with PHP 8.3, nginx, and Node.js 22.
– Database service running MariaDB 10.11.
4. **Mailpit** for email testing is available at [https://shareyourthoughts.ddev.site:8026](https://shareyourthoughts.ddev.site:8026).
How can I assist you further with this setup? Are you encountering any specific issues, or do you want to configure or optimize something?
—
### **Option 1: Using DDEV's Built-In Database Tools**
1. **Access the Database CLI**:
Run the following command to open the MySQL CLI for the existing database:
ddev mysql
2. **Create the New Database**:
Once in the MySQL CLI, execute:
CREATE DATABASE new_database_name;
Replace `new_database_name` with the desired name for your new database.
3. **Verify the Database**:
List all databases to confirm your new database was created:
SHOW DATABASES;
4. **Exit the MySQL CLI**:
Type:
exit
—
### **Option 2: Using phpMyAdmin (GUI Option)**
1. **Install phpMyAdmin**:
You can install phpMyAdmin as a DDEV service:
ddev get ddev/ddev-phpmyadmin
ddev restart
2. **Access phpMyAdmin**:
Open [http://shareyourthoughts.ddev.site:8036](http://shareyourthoughts.ddev.site:8036) (or the URL shown after installing the service).
3. **Login to phpMyAdmin**:
– Username: `db`
– Password: `db`
4. **Create a New Database**:
– Once logged in, go to the "Databases" tab.
– Enter your desired database name and click "Create."
—
### **Option 3: Import an Existing Database**
If you already have a database dump file (e.g., `new_database.sql`), you can import it into your DDEV project:
1. **Place the SQL File in Your Project Directory**:
Copy the file into your project folder, for example:
cp /path/to/new_database.sql ~/ddev-projects/shareyourthoughts/.
2. **Import the Database**:
Run the following command:
ddev import-db --src=new_database.sql --target-db=new_database_name
Replace `new_database_name` with your desired database name.
—
### **Access Credentials**
The new database will use the same credentials as your default DDEV database:
– **Host**: `db`
– **Username**: `db` or `root`
– **Password**: `db` or `root`
– **Port**: `3306`
You can configure your Laravel `.env` file to use this database by updating the `DB_DATABASE` value.
Let me know if you'd like assistance with any of these steps!