My local environment is:
with installed MySQL 5.7
sudo apt-get install mysql-common mysql-se
For Ubuntu 18.04 and mysql 5.7
step 1: sudo mkdir /var/run/mysqld;
step 2: sudo chown mysql /var/run/mysqld
step 3: sudo mysqld_safe --skip-grant-tables
& quit (use quit if its
stuck )
login to mysql without password
step 4: sudo mysql --user=root mysql
step 5: SELECT user,authentication_string,plugin,host FROM mysql.user;
step 6: ALTER USER 'root'@'localhost' IDENTIFIED WITH
mysql_native_password BY 'root'
now login with
mysql -u root -p <root>
You can try with the below commands:
hduser@master:~$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
hduser@master:~$ sudo /etc/init.d/mysql start
[ ok ] Starting mysql (via systemctl): mysql.service.
I tried with and it works
use mysql; # use mysql table
update user set authentication_string="" where User='root';
flush privileges;
quit;