Not able to access MariaDB even from LocalHost - Access denied for user 'root'@'puppetmaster29' (using password: YES)

I have a fresh MariaDB setup on Fedora 35, following some recommandation to able to access remotely, selinux is in permissive mode, I updated mariadb-server.cnf , bind address to the IP addess of the machine. 3306 port opened

when I try to log locally with the following

mysql -h -u root -pmyPassword

I get ERROR 1045 (28000): Access denied for user 'root'@'puppetmaster29' (using password: YES)

mysql -V mysql Ver 15.1 Distrib 10.5.13-MariaDB, for Linux (x86_64) using EditLine wrapper

Checking the status of the service with "systemctl status mariadb", it seems it is up and running correctly

● mariadb.service - MariaDB 10.5 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2022-01-11 18:53:16 CET; 1h 34min ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Process: 145108 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS) Process: 145130 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS) Process: 145181 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS) Main PID: 145165 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 8 (limit: 4575) Memory: 71.0M CPU: 1.182s CGroup: /system.slice/mariadb.service └─145165 /usr/libexec/mariadbd --basedir=/usr

Jan 11 18:53:15 puppetmaster29 mariadb-prepare-db-dir[145130]: Database MariaDB is probably initialized in /var/lib/mysql alread> Jan 11 18:53:15 puppetmaster29 mariadb-prepare-db-dir[145130]: If this is not the case, make sure the /var/lib/mysql is empty be> Jan 11 18:53:15 puppetmaster29 mariadbd[145165]: 2022-01-11 18:53:15 0 [Note] /usr/libexec/mariadbd (mysqld 10.5.13-MariaDB) sta> Jan 11 18:53:16 puppetmaster29 mariadb-check-upgrade[145211]: The datadir located at /var/lib/mysql needs to be upgraded using '> Jan 11 18:53:16 puppetmaster29 mariadb-check-upgrade[145211]: 1. Back-up your data before with 'mariadb-upgrade' Jan 11 18:53:16 puppetmaster29 mariadb-check-upgrade[145211]: 2. Start the database daemon using 'systemctl start mariadb.serv> Jan 11 18:53:16 puppetmaster29 mariadb-check-upgrade[145211]: 3. Run 'mariadb-upgrade' with a database user that has sufficien> Jan 11 18:53:16 puppetmaster29 mariadb-check-upgrade[145211]: Read more about 'mariadb-upgrade' usage at: Jan 11 18:53:16 puppetmaster29 mariadb-check-upgrade[145211]: https://mariadb.com/kb/en/mysql_upgrade/ Jan 11 18:53:16 puppetmaster29 systemd[1]: Started MariaDB 10.5 database server.

I checked permissions on mysql directory with

sudo ls -Al /var/lib/mysql

-rw-rw----. 1 mysql mysql 16384 Jan 11 17:59 aria_log.00000001 -rw-rw----. 1 mysql mysql 52 Jan 11 17:59 aria_log_control -rw-rw----. 1 mysql mysql 976 Jan 11 17:59 ib_buffer_pool -rw-rw----. 1 mysql mysql 12582912 Jan 11 17:59 ibdata1 -rw-rw----. 1 mysql mysql 100663296 Jan 11 17:59 ib_logfile0 -rw-rw----. 1 mysql mysql 12582912 Jan 11 17:59 ibtmp1 -rw-------. 1 mysql mysql 1197 Jun 23 2020 log000000000001.tokulog29 -rw-rw----. 1 mysql mysql 0 Jun 23 2020 multi-master.info drwx------. 2 mysql mysql 4096 Jun 23 2020 mysql srwxrwxrwx. 1 mysql mysql 0 Jan 11 17:59 mysql.sock -rw-rw----. 1 mysql mysql 16 Jun 23 2020 mysql_upgrade_info drwx------. 2 mysql mysql 20 Jun 23 2020 performance_schema drwxr-x--x. 2 mysql mysql 213 Jun 23 2020 '#rocksdb' -rw-rw----. 1 mysql mysql 16384 Jun 23 2020 tokudb.directory -rw-rw----. 1 mysql mysql 16384 Jun 23 2020 tokudb.environment -rw-------. 1 mysql mysql 0 Jun 23 2020 tokudb_lock_dont_delete_me_data -rw-------. 1 mysql mysql 0 Jun 23 2020 tokudb_lock_dont_delete_me_environment -rw-------. 1 mysql mysql 0 Jun 23 2020 tokudb_lock_dont_delete_me_logs -rw-------. 1 mysql mysql 0 Jun 23 2020 tokudb_lock_dont_delete_me_recovery -rw-------. 1 mysql mysql 0 Jun 23 2020 tokudb_lock_dont_delete_me_temp

doing mysqld -U root -p

2022-01-11 18:11:34 0 [Note] mysqld (mysqld 10.5.13-MariaDB) starting as process 135017 ... 2022-01-11 18:11:34 0 [Warning] Can't create test file /var/lib/mysql/puppetmaster29.lower-test mysqld: Can't create file '/var/log/mariadb/mariadb.log' (errno: 13 "Permission denied") 2022-01-11 18:11:34 0 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied") 2022-01-11 18:11:34 0 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control' 2022-01-11 18:11:34 0 [ERROR] Plugin 'Aria' init function returned error.

Answer Answered by Vicențiu Ciorbaru in this comment.

From your question, it is not clear if the *mariadb* root user is using unix_socket authentication as its authentication plugin.

Can you first try running: sudo mariadb -u root

with the server running and see if you get access?

If this doesn't work, stop mariadbd and restart the server with --skip-grant-tables option. This will make the server accept any incoming connection. Make sure the server can not be accessed from the outside.

Login to the server and run select * from mysql.global_priv table. This will help in understanding what sort of authentication setup you have for your server and we can then debug further.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.