Reinstalling MySQL fails at mysql_secuire_installation

I was trying to install LAMP on my Ubuntu 20.04 but somehow messed it up so I uninstalled and purged as shown here: https://www.digitalocean.com/community/questions/how-do-i-uninstall-and-reinstall-mysql

Basically entering commands:

apt-get remove -y mysql-*
and
apt-get purge -y mysql-*

Then I tried to reinstall and start "fresh" following instructions here: https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04

Basically entering commands:

sudo apt update

and
sudo apt install mysql-server

Everything looks to be working as I’m asked press Y or N when deleting the installation and then it seems to install but then I get to the next step of

Run the security script with sudo:

`sudo mysql_secure_installation`

and I get:
Error: Access denied for user 'root'@'localhost' (using password: YES)

On my previous installation I did not set a password so when I was installing PHPMyadmin, it told me to enter some commands to change from root using auth-socket to caching password but then another command to change root to use mysql native password.

That was when everything fell apart and I could no longer enter the mysql command line with any of these commands:
sudo mysql
sudo mysql -u root -p this threw an error after asking for the password. This is the reason for the re-install attempt.

But now it feels like my machine is remembering some of my past installation so that is why I cannot do that sudo mysql_secure_installation step even after installing.

This answer on SO said my password is in the error log but I don’t see it: https://stackoverflow.com/a/46194427/9481613

/var/log/mysql$ cat error.log
2021-06-03T23:42:09.623345Z 0 (System) (MY-010116) (Server) /usr/sbin/mysqld (mysqld 8.0.25-0ubuntu0.20.04.1) starting as process 27619
2021-06-03T23:42:09.634917Z 1 (System) (MY-013576) (InnoDB) InnoDB initialization has started.
2021-06-03T23:42:09.789313Z 1 (System) (MY-013577) (InnoDB) InnoDB initialization has ended.
2021-06-03T23:42:09.859632Z 0 (ERROR) (MY-011292) (Server) Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'
2021-06-03T23:42:09.859741Z 0 (ERROR) (MY-011300) (Server) Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'
2021-06-03T23:42:09.899660Z 0 (Warning) (MY-010068) (Server) CA certificate ca.pem is self signed.
2021-06-03T23:42:09.899852Z 0 (System) (MY-013602) (Server) Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-06-03T23:42:09.903005Z 0 (Warning) (MY-011810) (Server) Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2021-06-03T23:42:09.917140Z 0 (System) (MY-010931) (Server) /usr/sbin/mysqld: ready for connections. Version: '8.0.25-0ubuntu0.20.04.1'  socket: '/tmp/tmp.cGXeZwB2EQ/mysqld.sock'  port: 0  (Ubuntu).
2021-06-03T23:42:09.928818Z 0 (System) (MY-013172) (Server) Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.25-0ubuntu0.20.04.1).
2021-06-03T23:42:11.395123Z 0 (System) (MY-010910) (Server) /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.25-0ubuntu0.20.04.1)  (Ubuntu).
2021-06-03T23:42:13.403506Z 0 (System) (MY-010116) (Server) /usr/sbin/mysqld (mysqld 8.0.25-0ubuntu0.20.04.1) starting as process 27775
2021-06-03T23:42:13.413221Z 1 (System) (MY-013576) (InnoDB) InnoDB initialization has started.
2021-06-03T23:42:13.631162Z 1 (System) (MY-013577) (InnoDB) InnoDB initialization has ended.
2021-06-03T23:42:13.702872Z 0 (System) (MY-011323) (Server) X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2021-06-03T23:42:13.747183Z 0 (Warning) (MY-010068) (Server) CA certificate ca.pem is self signed.
2021-06-03T23:42:13.747414Z 0 (System) (MY-013602) (Server) Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-06-03T23:42:13.765757Z 0 (System) (MY-010931) (Server) /usr/sbin/mysqld: ready for connections. Version: '8.0.25-0ubuntu0.20.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).