Score:0

Fresh Ubuntu 23.04 and MySQL install but can't log into databases

cn flag

I've installed MySQL many times without a problem but now I cannot seem to log in to the databases. I created the same users as I always have with the same access and I can access the databases through Webmin but nowhere else whether PHP, PHPMyAdmin, HeidiSQL or other client.

The LAMP stack is on a desktop PC used for Web development and the log at /var/log/mysql/error.log just shows normal shut downs etc. but nothing else useful. It does have this warning but a password was created for root during installation. root@localhost is created with an empty password ! Please consider switching off the --initialize-inse (sorry, it goes off the screen where nano can't see it all.)

I then tried to uninstall and purge mysql, then reinstall but also got errors

Uninstalled and purged with:

sudo apt-get remove --purge mysql* -y sudo apt-get autoremove sudo apt-get autoclean sudo apt-get dist-upgrade

Reinstalled with: sudo apt-get -y install mysql-client mysql-server

ERROR: Database files are locked. Daemon already running? Warning: Unable to start the server. Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.

dpkg: error processing package mysql-server-8.0 (--configure): installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server: mysql-server depends on mysql-server-8.0; however: Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure): dependency problems - leaving unconfigured Processing triggers for man-db (2.11.2-1) ... No apport report written because the error message indicates its a followup error from a previous failure. Processing triggers for libc-bin (2.37-0ubuntu2) ... Errors were encountered while processing: mysql-server-8.0 mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1)

I have since once again stopped the mysql server, uninstalled and purged it, then reinstalled MySQL and it still gives the same errors. I am unable to log into it in terminal to set a root password. When originally installed, it prompted for it but this time it did not and is apparently running without one.

It gives the same errors as before:

don@Veriton-L480:~$ sudo mysql [sudo] password for don:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
in flag
Silly question, but is PHP and all the other things installed on the same machine where MySQL is running? Or are they on different devices on the same network? Depending on how MySQL is configured, failed login attempts may be recorded in the `/var/log/mysql/error.log` file, which could point towards the problem.
DonP avatar
cn flag
@matigo I will update the post with the answers as those are good questions.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.