From b9fb39339f36860046904f2855046a0c534007b0 Mon Sep 17 00:00:00 2001 From: Mehran Dehghanian Date: Sat, 29 May 2021 15:54:41 +0430 Subject: [PATCH] Add 'Create New Database And Database User' --- Create-New-Database-And-Database-User.md | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Create-New-Database-And-Database-User.md diff --git a/Create-New-Database-And-Database-User.md b/Create-New-Database-And-Database-User.md new file mode 100644 index 0000000..38efd7e --- /dev/null +++ b/Create-New-Database-And-Database-User.md @@ -0,0 +1,40 @@ +When installing ~~Matomo~~ you need to specify a MySQL (or MariaDB) database hostname, user and password. + +To create your database and database user, you would typically use your web hosting provider interface which would let you add a new MySQL database and create a new user with permission to access this database, in just a few clicks. + +If you are installing Matomo (Piwik) on your own server and/or don’t have a tool available to manage your database, you can manually create the MySQL database user by following these steps: + +#### Connect to your MySQL database: +``` +$ mysql +``` + +#### Create a database : +``` +$ mysql> CREATE DATABASE matomo_db_name_here; +``` + +#### Create a user called matomo, if you are using MySQL 5.7 or MySQL 8 or newer : +``` +$ mysql> CREATE USER 'matomo'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my-strong-password-here'; +``` + +Or if you are using an older version such as MySQL 5.1, MySQL 5.5, MySQL 5.6: + +``` +mysql> CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'my-strong-password-here'; +``` + +#### Grant this user ~~matomo~~ the permission to access your ~~matomo~~_db_name_here database : +``` +$ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON matomo_db_name_here.* TO 'matomo'@'localhost'; +``` +It is important to grant the user the following privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES + +#### (OPTIONAL) Grant this user matomo the FILE global privilege: (if enabled, reports will be archived faster thanks to the LOAD DATA INFILE feature) : + +``` +$ mysql> GRANT FILE ON *.* TO 'matomo'@'localhost'; +``` + +(source)[https://matomo.org/faq/how-to-install/faq_23484/] \ No newline at end of file