Posted under » MySQL » Ubuntu updated on 20 Jan 2023
I've just installed LAMP on Ubuntu 24.04 (works in 22.04). By default the root password for mysql is NULL. The idea is that you have to give a new password.
You have to change the authentication method by doing this.
$ mysql -u root -p mysql > SELECT user,plugin,host FROM mysql.user WHERE user = 'root'; mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MrsLKYsuck5'; mysql > FLUSH PRIVILEGES;
Take note that there are several authentications in MySQL. They are Native MySQL, SHA25 password, caching SHA2 and Unix socket authentication.
Next, you might want to install missing PHP mbstring libraries and etc.
Restart Mysql and You should be able to log in using phpmyadmin. Don't work? Maybe reread the older version of this.