Linux

Webmail Roundcube Directadmin ERROR: Database schema directory not specified (--dir).

The error `ERROR: Database schema directory not specified (--dir)` occurs when you run a Roundcube database-related command (like `updatedb.sh`) without specifying the directory where the database schema files are located. This typically happens during manual execution of the schema update script or database initialization. Let’s fix this step-by-step.

### Why This Happens
The `updatedb.sh` script (or similar commands in Roundcube) expects the `--dir` flag to point to the directory containing the SQL schema files (usually the `SQL` folder in the Roundcube installation). If you don’t provide this, it doesn’t know where to find the necessary files.

### Fixing the Error
#### Step 1: Locate the Schema Directory
- Navigate to your Roundcube installation directory (e.g., `/var/www/html/roundcube`).
- Check for the `SQL` folder:

ls /var/www/html/roundcube/SQL

- This folder contains schema files like `mysql.initial.sql` for initializing the database.

#### Step 2: Run the Command with `--dir`
- If you’re updating the schema, use the `updatedb.sh` script and specify the `--dir` option:

cd /var/www/html/roundcube
php bin/updatedb.sh --dir=SQL --package=roundcube

- The `--dir=SQL` tells the script to look in the `SQL` folder for the schema files.

#### Step 3: Verify Database Connection
- Ensure the database connection details in `config.inc.php` are correct (from your previous setup):

$config['db_dsnw'] = 'mysql://da_roundcube:PxHgzT99sOgcN@localhost/da_roundcube';


- If the connection still fails, test it manually:

mysql -u da_roundcube -pPxHgzT99sOgcN -h localhost da_roundcube

#### Step 4: Check the Context
- If this error appeared during initial setup (not an update), you might need to initialize the database instead:

mysql -u da_roundcube -pPxHgzT99sOgcN da_roundcube < /var/www/html/roundcube/SQL/mysql.initial.sql

- Then run the update script if needed:

php bin/updatedb.sh --dir=SQL --package=roundcube

### If You’re Still Stuck
- **Full Command Example**: If the above doesn’t work, provide the package version and database type explicitly:

php bin/updatedb.sh --dir=SQL --package=roundcube --database=mysql

- **Check PHP**: Ensure PHP is installed and the MySQL extension is enabled:

php -m | grep mysql

  - If missing, install it (e.g., `yum install php-mysqlnd` or `apt install php-mysql`).

### Relating to Your Previous Issue
This error might be a follow-up to your earlier database connection problem (`SQLSTATE[HY000] [2002]`). If you’ve fixed the connection but now hit this schema error, it’s likely because the automated DirectAdmin install didn’t complete the schema setup, and you’re manually running the update. The steps above should resolve it.

Let me know if you encounter another error or need clarification!