How to get to the database mariadb To access? - mariadb

When I log in to mariadb, I do not have access to a database named mysql.
I get the following error:
MariaDB [(none)]> use mysql
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'mysql'

Related

How to make MariaDB log in JSON format?

In MySQL you can make logging appear in JSON format by installing component_log_sink_json component and enabling this component:
INSTALL COMPONENT 'file://component_log_sink_json';
SET PERSIST log_error_services = 'log_filter_internal; log_sink_json';
Source: https://dev.mysql.com/doc/refman/8.0/en/error-log-json.html
But this does not work in MariaDB:
MariaDB > INSTALL COMPONENT 'file://component_log_sink_json';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPONENT 'file://component_log_sink_json'' at line 1
MariaDB > SET log_error_services = 'log_filter_internal; log_sink_json';
ERROR 1193 (HY000): Unknown system variable 'log_error_services'
How can I make MariaDB log in JSON format?

How can I fix this login error in MariaDB?

I recently install MariaDB and use DB
but it has error on login
I check my plugin
root localhost mysql_native_password
Enter password:
ERROR 1698 (28000): Access denied for user 'root'#'localhost'
How can I fix??
Recent versions of MariaDB will authenticate users via unix_socket plugin when connecting via unix_socket (localhost).
So if you need to connect as root, just do a
$ sudo mysql
and enter password afterwards.

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.

install moodle using 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".

MariaDB CONNECT engine to read external file

I would like to read an external file into MariaDB using the CONNECT engine. However, when trying to read from the file, I get an error message:
MariaDB [test]> create table test ( name varchar(100), team varchar(100) ) engine=CONNECT table_type=CSV file_name='/tmp/data.csv' header=1 sep_char=',' quoted=0;
Query OK, 0 rows affected (0.24 sec)
MariaDB [test]> select * from test;
ERROR 1296 (HY000): Got error 174 'Open() error 13 on /tmp/data.csv: Permission denied' from CONNECT
Checking the filesystem permissions gives me:
divingt#grisu ~ $ ls -l /tmp/data.csv
-rw-rw-rw- 1 divingt divingt 1658 Dec 31 13:59 /tmp/data.csv
So everybody should be able to read and write from the file.
Also in MYSQL the permissions allow for everything:
MariaDB [test]> SHOW GRANTS;
+------------------------------------------------------------------------------------------------+
| Grants for root#localhost |
+------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'#'localhost' IDENTIFIED VIA unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''#'%' TO 'root'#'localhost' WITH GRANT OPTION |
+------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
I run a Linux Mint system.
Thanks a lot for any help.
It turns out that the reason was that apparmor prevented mysqld from reading from reading the file. Disabling it (or changing the permissions) solved the problem.

Resources