diff --git a/core/templates/installation.php b/core/templates/installation.php
index c0b29ea909de8bf232f95644e875ee0af5f36e32..5a3bd2cc9f02d3c452057a24c63059c28d317429 100644
--- a/core/templates/installation.php
+++ b/core/templates/installation.php
@@ -111,7 +111,7 @@
 			</p>
 			<p class="infield">
 				<label for="dbname" class="infield"><?php echo $l->t( 'Database name' ); ?></label>
-				<input type="text" name="dbname" id="dbname" value="<?php print OC_Helper::init_var('dbname'); ?>" autocomplete="off" />
+				<input type="text" name="dbname" id="dbname" value="<?php print OC_Helper::init_var('dbname'); ?>" autocomplete="off" pattern="[0-9a-zA-Z$_]+" />
 			</p>
 		</div>
 		<?php endif; ?>
diff --git a/lib/setup.php b/lib/setup.php
index a072e00f91e89938d97c771127b337ca40770828..9231845da514a73fe68256dfec22f66cfdc00847 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -70,6 +70,9 @@ class OC_Setup {
 			if(empty($options['dbname'])) {
 				$error[] = "$dbprettyname enter the database name.";
 			}
+			if(substr_count($options['dbname'], '.') >= 1){
+				$error[] = "$dbprettyname you may not use dots in the database name";
+			}
 			if($dbtype != 'oci' && empty($options['dbhost'])) {
 				$error[] = "$dbprettyname set the database host.";
 			}