Mysql version - mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper.
I had forgotten my password and tried many commands online.Also the problem is that grant tables command not working in my terminal.
Mysql version - mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper.
I had forgotten my password and tried many commands online.Also the problem is that grant tables command not working in my terminal.
The following adjustments works for my setup:
$ sudo mkdir /var/run/mysqld
$ sudo chown mysql: /var/run/mysqld
$ sudo kill -9 $(sudo cat /var/run/mysqld/mysqld.pid)
I had tried all the approaches but didn't work for me. The following approach worked. I am hopeful that it will work on different versions of ubuntu.
mysql --version
mysql Ver 8.0.28-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
sudo systemctl stop mysql
// open the mysql systemd configuration file your default text editor.
// In my case, it is nano editor.
sudo systemctl edit mysql
// Add the following 3 lines
[Service]
ExecStart=
ExecStart=/usr/sbin/mysqld --skip-grant-tables --skip-networking
sudo systemctl daemon-reload
sudo systemctl start mysql
sudo mysql -u root
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'add-newpassword-here';
sudo systemctl revert mysql
You are all Done.