Mysql 8 has different method resetting pw then mysql 5. First is needed to set empty auth string
In Linux:
Stop mysqld
service mysqld stop
Start MySQL with skip grant tables
mysqld --skip-grant-tables --skip-networking --user=mysql &
Set authentication empty string
login
mysql -u root
Set empty auth string so could one time login to mysql without password
UPDATE mysql.user SET authentication_string='' WHERE user='root';
Find out mysqld pid and terminate it.
cat /var/lib/mysql/mysql.sock.lock
or
ps aux |grep mysqld
now
kill TERM pidnumber
Start MySQL in normal mode
service mysqld start
One time without pw login
mysql -u root
Set new password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
passsword must be numbers, strings and symbols and long (upon writing was used 16 chars password). Otherwise mysql policy denies new pw.
In Windows:
Stop mysqld
Use MS services to stop mysqld
Start MySQL with skip grant tables
Change into folder C:\Program Files\MySQL\MySQL Server 8.0\bin And start mysqld
mysqld --skip-grant-tables --skip-networking --shared-memory &
Set authentication empty string
login with cmd
mysql -u root
Set empty auth string so could one time login to mysql without password
UPDATE mysql.user SET authentication_string='' WHERE user='root';
Start MySQL in normal mode
Now terminate mysqld with via task manager and start mysqld normally via services
One time login without pw
mysql -u root
Set new password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
passsword must be numbers, strings and symbols and long (upon writing was used 16 chars password). Otherwise mysql policy denies new pw.