Simple Database Creation on MariaDB or MySQL

  • Creating a database on MariaDB or MySQL relational databases is pretty easy using the SQL commands. We just attach to the database server using the MySQL client.

    # mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 2
    Server version: 5.5.50-MariaDB MariaDB Server
    Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    MariaDB [(none)]> CREATE DATABASE wp_demo;
    Query OK, 1 row affected (0.00 sec)
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON wp_demo.* TO "demouser"@localhost
        -> IDENTIFIED BY "mypasswordsecret";
    Query OK, 0 rows affected (0.00 sec)
    MariaDB [(none)]> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)
    MariaDB [(none)]> EXIT