install moodle using Mariadb - mariadb

befor installing moodle on ubuntu 16.04 server i have installed MariaDB and create a privilage like this :
# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE moodle;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON moodle.* TO 'Admin'#'localhost' IDENTIFIED BY 'root';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q
after that i can with commande line access to moodle database with user: "Admin" and password:"root".
but in the install.php page of moodle if i give the user and password i got this error :
what is the problem please?

A bug in Moodle means it cannot detect the latest version of MariaDB database server used on all Ecenica Web Hosting packages and Managed Cloud Servers.
You can do the following:
Edit your Moodle config.php
Change $CFG->dbtype from mysqli to
mariadb
Save and Restart the installation of Moodle

It is an old post but, for someone who hits this page:
From the error it looks like the DB type selected in the screen prior to this was "MySQLi" instead of "MariaDb".

Related

Why does mariabackup always give me access denied?

Context
Running MariaDb 10.6.7 on Windows 11. Trying to use mariabackup to do a partial backup of my database. Database, target backup folder and backup process all on the same PC.
Issue
In a batch file I have this:
cd C:\"Program Files\MariaDB 10.6\bin"
mariabackup --backup --target-dir='D:\OneDrive\Backups\MariaDb' --databases-exclude="*test" --user=root --password=myPasswordWithNoQuotes
Which keeps giving me the response:
Failed to connect to MariaDB server: Access denied for user 'root'#'localhost' (using password: YES)
Things I've checked
Running the batch file as administrator
root has full priviliges
Password is correct - checked by logging into root with MySQL Workbench and MySQLClient and HeidiSQL.
Question
How do I set access rights so that the backup can proceed?
When I changed the root password to something simple everything worked. So it looks like the issue was a special character in the password (a % character perhaps) or the way that the password parameter was formed in the mariabackup command.

MariaDB System Versioned Tables Do Not Work Locally Even After MariaDB upgrade

So I used to have mysql installed on my mac via homebrew. I stared by uninstalling it and then installed maria with brew install mariadb
This shows me this version
> mysql --version
mysql Ver 15.1 Distrib 10.7.3-MariaDB, for osx10.17 (arm64) using EditLine wrapper
and this:
mariadb --version
mariadb Ver 15.1 Distrib 10.7.3-MariaDB, for osx10.17 (arm64) using EditLine wrapper
I can run mariadb and connect to it fine with this command:
mariadb -u root -p
However, I am not able to use the new feature of mariaDB called system versioned tables.
I have followed this guide: https://mariadb.com/kb/en/system-versioned-tables/ and entered this command
MySQL [(none)]> CREATE TABLE t ( x INT ) WITH SYSTEM VERSIONING;
Which gives this error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SYSTEM VERSIONING' at line 1
To test this further, I created a MariaDB instance in aws and connected to it locally with the same command which works fine. The version that RDS supports is 10.6
Question: "Why can't does my local instance of mariadb not recognize the keyword SYSTEM?
I am not sure how to debug this locally and I would like to know why this version of mariadb is unable to recognize these command locally. Looking for some debugging tips.
EDIT: Another thing to check was to select version while in the mariadb console
MySQL [(none)]> select version();
+-----------+
| version() |
+-----------+
| 8.0.28 |
+-----------+
8.0.28 is a MySQL version, which doesn't have System Versioned Tables, only MariaDB does (at the time of this posting anyway).
As noted, mysql --version only shows the version of the MySQL (or MariaDB via compatibility links) client. It doesn't show the server version.

MariaDB Galera Cluster: issue with replication

Here is my setup:
4 VMs (running on CentOS 7)
VM1 with mariadb-client and maxscale for load balancing (I have tried haproxy, results are the same). httpd and php (I am testing this with WordPress installation)
VM2, VM3, VM4 with mariadb-server, galera, rsync
Software installation
adding repository "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash" on all 4 VMs
installing MariaDB-server on VM2, VM3, VM4 (this includes galera and all the required software)
installing maxscale and MariaDB-client on VM1
Editing config files
on VM2, VM3, VM4 I have added:
https://gist.github.com/yarko686/5adb7b24784c4c3c24a526519623d930
to /etc/my.cnf.d/server.cnf
on VM1 I have added the following lines to /etc/maxscale.cnf https://gist.github.com/a67e94afaa4ecc57ccb985d897ee3e87.git
Staring the cluster
on VM2 I have executed galera_new_cluster
on VM3 and VM4 I have executed systemctl start mariadb
Checking the cluster
on VM2 I am accessing mysql using mysql -u root then executing:
show global status like 'wsrep_cluster_size';
I receive this output https://gist.github.com/yarko686/a63c925b3275d239f38d50f0651e45ef it means that there are 3 machines in cluster
Creating maxscale user and wordpress users
Login to MySQL CLI on VM2 using mysql -u root and executing the following commands
https://gist.github.com/yarko686/950ea62f79638a6f293c28b99dd19f7b
for WordPress user I use the same commands, except .. I these cases, I'm using wordpress_db.* instead.
The main issue.
after importing WordPress database, it is properly created only on VM2 only. On VM3 and VM4 the database and tables are created, however, for some reason they are empty.
If I access wordpress database through MySQL CLI using my wordpress user and create new table with some data it gets replicated, but when I add user to my wp_users table (or add user through wp-admin) it is not replicated. The record gets created only on VM2 and not on VM3 and VM4.
check to see if the tables are innodb instead of isam.
I know on my setup when I imported old isam tables, the tables would appear, but the data wouldn't replicate. I had to convert all of the tables to innodb.

ERROR 2002 (HY000): Can't connect to MySQL server on 'localhost' (10061)

I install a laragon on my windows 10 and using the latest mariadb database
Ver 15.1 Distrib 10.2.12-MariaDB, for Win64 (AMD64)
but when I try to connect using this command
mysql -u root -p
I received this error
ERROR 2002 (HY000): Can't connect to MySQL server on 'localhost' (10061)
What is this error?
I don't know what to do.
When you install MariaDB, by default it creates a database called "mysql".
If you delete that database, that exact error will appears. The solution is either recover that database or reinstall mariadb. I spent one day figuring out why does that error appeared to me.
Conclusion: Don't delete "mysql" database from mariadb.

Debian Stretch MariaDB cannot authenticate from PHP application

I'm using a fresh installation of Debian Stretch, and installed PHP7 and MariaDB as recommended:
sudo apt-get install nginx mariadb-server mariadb-client php-mysqli php7.0-fpm php7.0-curl
Then using sudo mysql_secure_installation I followed the prompts to remove test users etc.
MariaDB seems to use unix_socket authentication (which is a new concept to me). I like how it restricts root access to sudoers and allows me to grant DB permissions to specific OS users.
However I'd prefer to assign individual user/passwords for each web application running on the server. They all run as www-data user on the system and I see no reason to let them share databases.
So I created a user for my first PHP script and granted access to a new database:
CREATE USER 'telemetry'#'localhost' IDENTIFIED BY 'yeah_toast';
UPDATE mysql.user SET plugin='mysql_native_password' WHERE user='telemetry';
GRANT ALL PRIVILEGES ON telemetry TO 'telemetry'#'localhost';
FLUSH PRIVILEGES;
But it refuses to let me connect from the application:
[error] 19336#19336: *20 FastCGI sent in stderr: "PHP message: PHP Warning: mysqli::real_connect(): (HY000/1045): Access denied for user 'telemetry'#'localhost' (using password: YES) in /path/to/database.inc.php on line 30
The credentials I'm using from the application are as follows:
Host: localhost (also tried 127.0.0.1)
Username: telemetry
Password: yeah_toast
Database: telemetry
I tried deleting and re-creating the username in case it was a password problem, and creating a user #'localhost' and #'%' but none seem to work. In fact when I log in using the same credentials from the command line without sudo it works great (mysql -utelemetry -p).
Am I missing a MariaDB configuration step here?

Resources