# Database name on Wordpress can't include hyphen, but our host has mandatory prefix-hyphen-name format

Is there any way we can work around this?

Our Joomla install was quite happy to use a db of format xxnn-yyyyyy.

When we create or rename db using phpMyAdmin we can only choose the yyyyyy. "xxnn-" is automatic.

The CiviCRM Installer had an error to the question "Is the provided database name valid? The database name provided is not valid. Please use only 0-9, a-z, A-Z and _ as characters in the name."

Found how to resolve this one, but bit concerned that this fudge might break something further on down the line.

The CiviCRM installer page is driven by the file: wp-content/plugins/civicrm/civicrm/install/index.php.

This runs various checks and the db name check is on line 464 showing a call to CRM_Core_DAO to function requireValidDBName.

This function is in php file: wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php. Editing the preg_match string to include hyphens after the underscore allows these in the file name.

public static function requireValidDBName($database) {$matches = array();
preg_match(
"/^[0-9]*[a-zA-Z_-]+[a-zA-Z0-9_-]*$/",$database,
$matches ); if (empty($matches)) {
return FALSE;
}
return TRUE;
}