Skip to main content

Step-by-Step MariaDB

Step-by-Step MariaDB

Setting up a database:

  1. Create a database
  2. Create a user
  3. Create a table
  4. Create a column
  5. Create indexes
  6. Add foreign keys

Using the database:

  1. INSERT
  2. SELECT
  3. UPDATE
  4. DELETE

Create a User


MariaDB Statements

CREATE USER IF NOT EXISTS
'db_user'@'%' IDENTIFIED BY 'user_password'
PASSWORD EXPIRE NEVER;

GRANT SELECT, INSERT, UPDATE, DELETE
ON `db_name`.*
TO 'db_user'@'%';
Where db_user is the desired database user's name, user_password is the user's password and db_name is the database name that the user can access.

phpMyAdmin

Note

It is important to create a user for a specific database, with limited access, as a security measure when you want a script accessing the database.
The example shown here gives the typical basic access needed (SELECT, INSERT, UPDATE, DELETE) on a specific database. Some special cases may require other privileges granted that can be added at a later time.

References

MariaDB

MySQL