MySQL-Verbindung mit PHP herstellen
Tipp:
Vorher einen PHP-Webserver und einen MySQL-Datenbank-Server installieren: XAMPP – Download & Installation
Um mit einem PHP-Script eine Verbindung mit einer MySQL-Datenbank herzustellen, benötigt man folgendes Script.
dbsettings.php
<?PHP $dbpraefix = 'cms_'; $dbhostname = 'mysqldb.bottcher.info'; $dbusername = 'dbuser'; $dbpassword = 'dbpassword'; $db = 'database'; ?>
dbconnect.php
<?PHP
include('dbsettings.php');
$connection = mysql_connect($dbhostname,$dbusername,$dbpassword);
if (!$connection) {
die('Keine Verbindung möglich: ' . mysql_error());
}
else {
//Verbindung erfolgreich
mysql_select_db($db,$connection);
}
?>
https://www.tutorialspoint.com/mariadb/mariadb_connection.htm

