database with mysql code example
Example 1: login to mysql
mysql -u USERNAME -p
Example 2: using mysql database with php
<?php
$servername = "localhost";
$username = "yourusername";
$password = "yourpassword";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
Example 3: how to create database using cmd mysql
CREATE DATABASE [IF NOT EXISTS] database_name
[CHARACTER SET charset_name]
[COLLATE collation_name]