Comments - Troubleshooting Connection Issues

 
4 months, 3 weeks ago Bob Hastings

Installing MariaDB (a.k.a. MySQL) for the first time on my desktop PC, I experienced a number of issues and followed quite a few false leads in attempting to solve them before finding that I needed to follow a few simple steps at installation time. To experts they may seem obvious, but the following may assist newbies like myself.

(1) Download and install both the mysql (or mariadb) package (the client) AND the mariadb-server package (the server)! In retrospect this seems obvious, but in my case the client and server run on the same machine, and I naively assumed that the mariadb package contained everything I needed to get up and running. Of course it doesn't, and invoking mysql produced an error message saying that the required connection socket did not exist.

(2) After installing the server, it needs to be started, otherwise you get the same socket error. For example on my Fedora Linux system:

sudo systemctl start mariadb.service

(3) Running MySQL as an ordinary user, it now starts, but returns a "Permission denied error", because users need to be GRANTed permission to access the databases. This is fixed by running MySQL as root and using the GRANT command, eg.:

GRANT ALL PRIVILEGES ON *.* to 'alexander'@'localhost';

I hope this is a help to somebody.

 
2 years, 6 months ago Nick Chomey

Sorry, I can't figure out where to post this question and this seems as good as anywhere...

There appears to be an error with MariaDB when installed on Ubuntu 18.04 and 20.04. It does not happen with AlmaLinux. With a fresh install of either and apt install mariadb, if you run systemctl status mariadb, it says the following:

Mar 17 17:41:13 guest /etc/mysql/debian-start[45645]: Upgrading MySQL tables if necessary. 
Mar 17 17:41:13 guest /etc/mysql/debian-start[45649]: Looking for 'mysql' as: /usr/bin/mysql 
Mar 17 17:41:13 guest /etc/mysql/debian-start[45649]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck 
Mar 17 17:41:13 guest /etc/mysql/debian-start[45649]: This installation of MariaDB is already upgraded to 10.3.34-MariaDB. 
Mar 17 17:41:13 guest /etc/mysql/debian-start[45649]: There is no need to run mysql_upgrade again for 10.3.34-MariaDB. 
Mar 17 17:41:13 guest /etc/mysql/debian-start[45649]: You can use --force if you still want to run mysql_upgrade

This implies that it is trying to run mysql_upgrade when it shouldn't be. This issue is further compounded when I install CyberPanel, which seems to change something such that it tries to run mysql_upgrade without the root password. That results in these messages

Mar 17 15:47:53 intel-high-freq systemd[1]: Starting MariaDB 10.3.34 database server... 
Mar 17 15:47:54 intel-high-freq mysqld[1037]: 2022-03-17 15:47:54 0 [Note] /usr/sbin/mysqld (mysqld 10.3.34-MariaDB-0ubuntu0.20.04.1) starting as process 1037 ... 
Mar 17 15:47:55 intel-high-freq systemd[1]: Started MariaDB 10.3.34 database server. 
Mar 17 15:47:55 intel-high-freq /etc/mysql/debian-start[1213]: Upgrading MySQL tables if necessary. 
Mar 17 15:47:55 intel-high-freq /etc/mysql/debian-start[1221]: Looking for 'mysql' as: /usr/bin/mysql 
Mar 17 15:47:55 intel-high-freq /etc/mysql/debian-start[1221]: Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client 
Mar 17 15:47:55 intel-high-freq /etc/mysql/debian-start[1221]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 
Mar 17 15:47:55 intel-high-freq /etc/mysql/debian-start[1221]: FATAL ERROR: Upgrade failed 
Mar 17 15:47:55 intel-high-freq /etc/mysql/debian-start[1263]: Checking for insecure root accounts. 
Mar 17 15:47:55 intel-high-freq debian-start[1268]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Websites work on the server, so MariaDB is working fine. So perhaps this is just an issue with systemctl status mariadb...

You can see more about all of this in the CyberPanel forum here: https://community.cyberpanel.net/t/mariadb-errors-on-ubuntu-20-04-only-when-using-cyberpanel/20345

 
2 years, 3 months ago Stephen Fletcher

You could edit /etc/mysql/debian-start to not run the function "upgrade_system_tables_if_necessary" (or edit the packages mysql.service unit file in /etc/systemd/system/ to not run the script by removing the line "ExecStartPost=/etc/mysql/debian-start" but this will stop two other checks from running as well...)

It means on upgrading the Mysql service to a newer version you may need to manually run an upgrade command to get functions etc working again. Not sure what else it may impact but I assume thats it. Its like this in the upstream mariaDB supplied .deb package

Annoying that it looks like an error on every start of the database but I think I will just leave it how it is

 
3 years, 11 months ago Abel B

I m using mariadb 10.5.5 on freebsd 12.1 with NGINX 1.19.3 and PHP7.4 I m trying to install a codeignitor application and i get an error "No such file or directory"

I tried to install Wordpress Application and it gives me "error establishing connection".

how to check mariadb connection on freebsd

I cannot use the Pipe keys on the server

Please assist

 
4 years, 4 months ago Roberto Lattuada

Hi,

I get a very strange message for a failed connection to a MariaDB 10.2.31 database. The connection comes from an application (Manticore) using libmysqlclient.so.18

This is the error message: 2020-04-27 15:54:24 139657574090496 [Warning] Access denied for user '**'@'localhost' (using password: YES)

I tried with using the same credentials from a terminal with mysql and all is good.

I tried using a wrong password from a terminal and the error message shows the user name correctly.

Now the question is: what would trigger the error reporting to displaying "**" instead of the user name ?

Or is it exactly this string that is passed on the connection DSN by the client ?

Is there any way to debug this ?

Thanks Roberto

 
8 years, 9 months ago Wei Yang

Does MariaDB 5.5.X allow IPv6 connections? I can't seem to find this information anywhere.

 
8 years, 9 months ago Ian Gilfillan

Yes, it does.

 
8 years, 9 months ago Wei Yang

Mmm, I'm having trouble pulling the IPv6 addresses as a resource using mysql_connect() - is that a php (ver 5.6.16) problem or DB (mariaDB 5.5.44) problem? The error I get is:

mysql_connect(): Unknown MySQL server host

 
8 years, 9 months ago Ian Gilfillan

For debugging purposes, try connect directly with just the client first. If that works, you can try get it working in PHP. If not, it's a connection issue. Also note that mysql_connect has been deprecated since PHP 5.5.0, so really shouldn't be used anymore.

 
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.