Unable to reset mysql root password for windows 10 - mysql

I had installed mysql 5.7 and later uninstalled it. I had set a password which I have forgotten . Now, when I try to install mysql 5.7 again using mysql installer,it asks for password before installing.
I tried to reset the password using the procedure shown in dev.mysql page,youtube but all in vain.I am unable to reset the password.
Methods I tried are:
1)setting the mysql-init.txt in C:\ as ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
2)setting the mysql-init.txt in C:\ as UPDATE mysql.user
SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
1)running the command prompt in admin mode and running C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:\> mysqld --init-file=C:\\mysql-init.txt
Nothing actually seems to work. I get the wrong password error again when I try to install.

The passwords of MySQL are stored inside the MySQL database.
Delete the database data files. And see what the installer says then....
You can find your database data files location in the my.ini

I found that I had to specify the correct data directory via --datadir:
mysqld --init-file=C:\\mysql-init.txt --datadir="C:\ProgramData\MySQL\MySQL Server 5.7\Data" --console
It was by default trying to use: C:\Program Files\MySQL\MySQL Server 5.7\data
As mentioned by #sliver, you can find the data location in the my.ini file.

Add below queries to mysql-init.txt
ALTER USER `"root"`#`"localhost"` IDENTIFIED BY `"root#123"`;
UPDATE mysql.user SET authentication_string = PASSWORD(`"root#123"`)
WHERE User = `"root"` AND Host = `"localhost"`;
and run
mysqld --init-file=C:\\mysql-init.txt

place the file reset.txt
ALTER USER 'root'#'localhost' IDENTIFIED BY 'root';
execute the below command
mysqld --init-file=C:\\mysql-init.txt --datadir="C:\ProgramData\MySQL\MySQL Server 5.7\Data"

Related

How to reset MySQL root password using xampp/phpmyadmin? [duplicate]

I have a little problem with my phpmyadmin, in fact I accidentally delete multiple user accounts.
Since it is impossible to connect without the error:
# 1045 - Access denied for user 'root' # 'localhost' (using password: NO)
I have search a little on the net before, and even the technic:
UPDATE mysql.user SET Password = PASSWORD ('') WHERE User = 'root';
FLUSH PRIVILEGES;
does not work, or I didn't understood how it worked.
I'm on FreeBSD 8.1, my version of PhpMyadmin is 2.11.
Thank you in advance for your answers.
I summarised my solution here: http://snippets.dzone.com/posts/show/13267
sudo stop mysql
sudo mysqld --skip-grant-tables --skip-networking
mysql
mysql> update mysql.user set password = password('your_new_password') where user = 'root';
mysql> flush privileges;
mysql> exit;
sudo mysqladmin shutdown
sudo start mysql
For mysql 5.7.16 or later I found this (from mysql.com) to be the working solution. Below are some points which are different compared to previous older versions
1) I used the below command to run mysql in safe mode as per some other references which actually worked fine for me (mysql 5.7.16 ubuntu 16.04).
mysqld_safe --skip-grant-tables --skip-networking
2) The below update stmt is NOT working for later version (ie. 5.7 and above)
-- NOT Working for 5.7 and later
UPDATE mysql.user SET Password = PASSWORD ('') WHERE User = 'root';
FLUSH PRIVILEGES;
INSTEAD use below for 5.7.6 and later
UPDATE mysql.user
SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
OR user below for 5.7.5 or earlier versions.
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
I am Using MySQL Server 8 and this is how I solved this problem.
create a file and name it accordingly. I've named it as reset.txt. put below content in the file but change MyNewPass. This will be your new SQL password
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
Stop my SQL server (Go to services and search MYSQL and right-click on it and stop )
Now open a cmd in your bin folder of My SQLserver directory. in my case it's
C:\Program Files\MySQL\MySQL Server 8.0\bin
execute the following command.
mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --init-file="C:\reset.txt'
NOTE: my reset.txt file is in the c drive. Give the correct path. Check my.ini file is in the directory. In my case, it is in
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
Finally, restart the SQL Server. Check with your new password.
Please follow the instruction from the below link to reset your root password.You have to do it from outside mysql.
Resetting MySql Password
Forgetting your MySQL password can be a real headache for you.Here are some easy steps that you can follow to recover MySql password under Windows
Stop MySql
You have to stop MySql service before you proceed.In Windows environment, go to 'Task Manager' and Under 'Service' tab find MySQL and stop it.
Write Sql to change your password
All you need to do is to create a text file and put the below two lines into that. UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES; Save it under C:\ drive and give it a name 'mysql-init.txt'
Time to restart MySQL by your own.
Now it's time to restart your MySQl which you stopped in before but this time from command line. C:> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt
Finishing up!
Now you can log in with your new password. When you finish remove the file that you created in the previous stage.
Also there is a link (http://kaziprogrammingblog.osinweb.com/article/showarticle/Resetting-MySql-Password) where I have explained the same thing.
Hope this will help..:)
Answer for XAMPP on Windows:
Edit C:\xampp\mysql\bin\my.ini and insert skip-grant-tables below [mysqld]
Restart MySQL from Control Panel interface
In the phpMyAdmin window, select SQL tab from the top panel. This will open the SQL tab where we can run the SQL queries. Now type the following query in the text area and click Go
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;
Remove the skip-grant-tables in the my.ini file
Restart MySQL from Control Panel interface
DONE!
Be awared that mysql root user password does not have to be the same as password for phpmyadmin.
here is what I did and it worked:
After you install (rpm installation), do a vi /etc/my.cnf.
This will give you a path where your datadir is set. For me it was datadir=/var/lib/mysql.
Add a line there user=root, and remove all the content inside the datadir path: rm -rf /var/lib/mysql/*.
Now hit the command: mysqld --initialize.
A temporary password is generated at a location. For this:
grep "A temporary password" /var/log/*.
You will get a line that says:
/var/log/mysqld.log:2018-05-01T15:13:47.937449Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root#localhost: &uosjoGfi9:K. So for me &uosjoGfi9:K was my temporary password.
Now do a mysql -u root -p. Paste your temporary password from what you got from above.
You will be in your mysql cli mode. Now do:
mysql> use mysql;
You will be asked to reset your password:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Run your ALTER command:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPswd';
And you are done.
in my case its a frustrating Windows Server installation (iis/php/mysql) so this is what i did:
PART 1: remove the old MYSQL :
NOTE: if you already have data you should back it up!
Step 1
Uninstall MySQL from Control Panel. (you should know how to do this)
Step 2
Run Command Prompt as Admini and execute the following commands to stop and remove MySQL service.
Net stop MySQL
Sc delete MySQL
Step 3
Delete these folders:
C:\Program Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
And if it exists:
C:\Users\[User-Name]\AppData\Roaming\MySQL
PART 2: Install MYSQL
Download installer from https://dev.mysql.com/downloads/installer/ and install
-MySQL Server 8.0.23
open cmd as admin and go to
c:\Program Files\MySQL\MySQL Server 8.0\bin\
run
mysqld --initialize --console
mysqld --install
now start the service (type services.msc in run panel)
now back to console run:
mysql -u root -p
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
that's it
mysql80:
update user SET authentication_string='your password after encode to sha256' where User='root';

unable to reset mysql 'root' password

I have installed mysql 5.7.18. After installation the password of root user is null.
I have tried mysql_secure_instattation and following queries to reset ther password.
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyPassword';
and
UPDATE mysql.user
SET authentication_string = PASSWORD('MyPassword'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
These methods executed successfully but still mysql root user is connecting NULL password.
What should I do ?
Forse stopping the server: if it is running as a service, use the task manager. (or with services)
Create a file C:\mysql-init.txt (for example) where you type:
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
Open the cmd (as administrator) and run this:
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:\> mysqld --init-file=C:\\mysql-init.txt
NOTE: if you are working with MySQL 5.7.5 and earlier, change the command line with this one:
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
You can update your MySQL password with the following command too:
mysqladmin -u root -p'oldpassword' password newpass
This is due to,MySQL is using unix_socket plugin instead of mysql_native_password plugin for root user which means mysql trusts the credentials of Linux root user. If you are loggied in with linux root user, MySQL won't ask for saperate credentials for MySQL root user. Hence even after changing password successfully for MySQL root user, it was connecting with No password.

How to recover/Change MySQL Password

Yesterday Everything was working fine. Today when i start mysql its start giving me following error message
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I don't know when and how it sets password.
Now i am trying to set password, but its not updating it.
I am using following steps to recover password.
Stop Mysql Service
Write this in cmd:
C:\Program Files\MySQL\MySQL Server 5.5>mysqld.exe
--defaults-file="my.ini" --init-file="d:\mysql-init.txt" --console
It start showing me progress but stop responding after this message
160504 18:01:54 [Note] Server socket created on IP: '0.0.0.0'.
160504 18:01:54 [Note] Event Scheduler: Loaded 0 events
160504 18:01:54 [Note] mysqld.exe: ready for connections.
Version: '5.5.38' socket: '' port: 3306 MySQL Community Server (GPL)
I waited for more than 10 minutes but its not showing any progress after this..
Kindly guide me how to resolve this problem.
Thanks
Stop the mysql service
Edit the my.ini file or my.cnf file
Find the [mysqld] section in the ini file and add this line directly after the section [mysqld]
skip-grant-tables
Restart the mysql service.
Open the MySQL console
Now we are going to reset the password for the root user, of course this could be used to reset any users password.
Enter the following 2 commands at the mysql> command prompt, each with a semi colon at the end of a line, and press ENTER after each line to issue the command to mysql.
Pre MYSQL version 5.7
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
Post MYSQL version 5.7 the column name changed
UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';
ALTER USER 'root'#'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;
Note that the update may report that it has updated more than one row, that because there are actually 3 user accounts with the userid of 'root' each with a different domain i.e. 127.0.0.1, localhost and ::1
Now enter quit at the mysql command prompt to exit mysql.
Stop the mysql service
Edit the my.ini file or my.cnf file
Find the {mysqld] section in the ini file and Remove the skip-grant-tables parameter we added earlier.
DO NOT Leave this parameter in the ini file its a HUGH security hole.
Restart the mysql service.
You should now be able to login with phpmyadmin using the userid 'root' and the new password you have just set for that user.
Follow step-by-step to change mySQL root password.
1) Log on to server as Administrator.
2) Stop the MySQL service or kill it [mysqld-nt.exe] from Task manager [if not worked from services.msc].
3) Create a text file containing the following statements:
UPDATE mysql.user SET Password=PASSWORD('test#123') WHERE User='root';
FLUSH PRIVILEGES;
4) Save the file. For this example, the file will be named C:\mysql-init.txt.
5) Get to the command prompt: Start the MySQL server with --init-file option.
6) C:> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt
Stop mysql service
/etc/init.d/mysql stop
Skip mysql privilegies
/usr/bin/mysqld_safe --user=mysql --skip-grant-tables
Open cmd and write
mysql
Now let's use our database with this command:
use MY_DATABASE_NAME;
Update field password of the root user with the next command:
UPDATE user SET Password=PASSWORD('ourpassword') WHERE user='root';
Exit command.
exit
Initiate a new database session.
mysql -u root -p

How to change the mysql root password

I have installed MySQL server 5 on redhat linux. I can't login as root so I can't change the root password.
mysql -u root -p
Enter password: <blank>
ERROR 1045 (28000): Access denied for user 'root'#'localhost'
(using password: NO)
When I try to set one like this:
mysqladmin -u root password 'newpass'
I get an error:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost'
(using password: NO)'
As if there is a root password set.
I have also tried resetting the password using (described here)
/sbin/service mysqld start --skip-grant-tables
And then making:
mysql> UPDATE mysql.user SET Password=PASSWORD('newpass')
-> WHERE User='root';
ERROR 1142 (42000): UPDATE command denied to user ''#'localhost' for table 'user'
I even uninstalled mysql-server (using yum) and then reinstalled it but that did not help.
How do I force reset the root password?
One option is to save UPDATE mysql.user SET Password=PASSWORD('newpass') WHERE User='root'; into a file and then manually start mysqld with --init-file=FILENAME. Once the server starts, it should reset your password, and then you should be able to log in. After this, you should shut down the server and start it normally.
A little late to the game, but I had the same issue on a raspberry pi install and found out that it needs elevation. Adding a sudo to the front of the password change allowed it to work.
sudo mysqladmin -u root password 'newpass'
followed by an elevated sql access
sudo mysql -u root -p
If either are not run as sudo, it will fail.
The root user password is an empty string by default.
And (using password: NO) says that there is no password.
Do you try to login from another system? I imagine you can only login as root user locally.
I removed the MySQL installation and deleted the data files, and then reinstalled it.
Then I was able to set the root password. Once you set the root password to something. mysqladmin won't let you reset it if you don't know it.
To reset it, you've got to have ownership over how mysqld is executed, and feed it an init file to change the root password:
https://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
This helped me on Windows with MySQL Server 5.6. Make sure you change the mysqld path to point to where you have installed MySql Server, for me it was "C:\Program Files\mysql\MySQL Server 5.6\bin\mysqld.exe":
Log on to your system as Administrator.
Stop the MySQL server if it is running. For a server that is
running as a Windows service, go to the Services manager:
From the Start menu, select Control Panel, then
Administrative Tools, then Services. Find the MySQL
service in the list and stop it.
If your server is not running as a service, you may need to use
the Task Manager to force it to stop.
Create a text file containing the following statements.
Replace the password with the password that you want to use.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
Write the UPDATE and FLUSH statements each on a single line. The UPDATE statement resets the password for all root accounts, and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.
Save the file. For this example, the file will be named C:\mysql-init.txt.
Open a console window to get to the command prompt: From the Start menu, select Run, then enter cmd as the command to be run.
Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled):
C:\> C:\mysql\bin\mysqld --init-file=C:\\mysql-init.txt
If you installed MySQL to a location other than C:\mysql, adjust the command accordingly.
The server executes the contents of the file named by the --init-file option at startup, changing each root account password.
You can also add the --console option to the command if you want server output to appear in the console window rather than in a log file.
If you installed MySQL using the MySQL Installation Wizard, you may need to specify a --defaults-file option:
C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld.exe"
--defaults-file="C:\\Program Files\\MySQL\\MySQL Server 5.5\\my.ini"
--init-file=C:\\mysql-init.txt
The appropriate --defaults-file setting can be found using the Services Manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list, right-click it, and choose the Properties option. The Path to executable field contains the --defaults-file setting.
After the server has started successfully, delete C:\mysql-init.txt.
http://docs.oracle.com/cd/E17952_01/refman-5.5-en/resetting-permissions.html
Remove the -p from your command. -p forces the prompt for password.
Use :
mysql -u root
This will resolve your problem.
Probably a bit late here , but here is what I did :
create file resetpass.sh which has :
UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';
# mysqld_safe --init-file=resetpass.sh
# service mysqld start --skip-grant-tables
# mysql -u root -p
Enter pass
mysql > change root pass ; flush privs;
quit
# restart mysql service
The MySQL version I was using was 5.1.73 under centos6
Try do this:
mysql -u root
and then:
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;
Worked fine for me!
According to the docs, in MySQL 5.7 the temp password gets put in /var/log/mysqld, but this is evidently not the case in 5.6.
With MySQL version 5.6 installed on RHEL 6.7, I finally found the temporary root password set during install was placed in the file /root/.mysql_secret.
open mysql
now enter the following commands :
use mysql;
update user set PASSWORD=password("updated password") where User='root';
flush privileges;

How to reset mysql root password?

I have a little problem with my phpmyadmin, in fact I accidentally delete multiple user accounts.
Since it is impossible to connect without the error:
# 1045 - Access denied for user 'root' # 'localhost' (using password: NO)
I have search a little on the net before, and even the technic:
UPDATE mysql.user SET Password = PASSWORD ('') WHERE User = 'root';
FLUSH PRIVILEGES;
does not work, or I didn't understood how it worked.
I'm on FreeBSD 8.1, my version of PhpMyadmin is 2.11.
Thank you in advance for your answers.
I summarised my solution here: http://snippets.dzone.com/posts/show/13267
sudo stop mysql
sudo mysqld --skip-grant-tables --skip-networking
mysql
mysql> update mysql.user set password = password('your_new_password') where user = 'root';
mysql> flush privileges;
mysql> exit;
sudo mysqladmin shutdown
sudo start mysql
For mysql 5.7.16 or later I found this (from mysql.com) to be the working solution. Below are some points which are different compared to previous older versions
1) I used the below command to run mysql in safe mode as per some other references which actually worked fine for me (mysql 5.7.16 ubuntu 16.04).
mysqld_safe --skip-grant-tables --skip-networking
2) The below update stmt is NOT working for later version (ie. 5.7 and above)
-- NOT Working for 5.7 and later
UPDATE mysql.user SET Password = PASSWORD ('') WHERE User = 'root';
FLUSH PRIVILEGES;
INSTEAD use below for 5.7.6 and later
UPDATE mysql.user
SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
OR user below for 5.7.5 or earlier versions.
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
I am Using MySQL Server 8 and this is how I solved this problem.
create a file and name it accordingly. I've named it as reset.txt. put below content in the file but change MyNewPass. This will be your new SQL password
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
Stop my SQL server (Go to services and search MYSQL and right-click on it and stop )
Now open a cmd in your bin folder of My SQLserver directory. in my case it's
C:\Program Files\MySQL\MySQL Server 8.0\bin
execute the following command.
mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --init-file="C:\reset.txt'
NOTE: my reset.txt file is in the c drive. Give the correct path. Check my.ini file is in the directory. In my case, it is in
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
Finally, restart the SQL Server. Check with your new password.
Please follow the instruction from the below link to reset your root password.You have to do it from outside mysql.
Resetting MySql Password
Forgetting your MySQL password can be a real headache for you.Here are some easy steps that you can follow to recover MySql password under Windows
Stop MySql
You have to stop MySql service before you proceed.In Windows environment, go to 'Task Manager' and Under 'Service' tab find MySQL and stop it.
Write Sql to change your password
All you need to do is to create a text file and put the below two lines into that. UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES; Save it under C:\ drive and give it a name 'mysql-init.txt'
Time to restart MySQL by your own.
Now it's time to restart your MySQl which you stopped in before but this time from command line. C:> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt
Finishing up!
Now you can log in with your new password. When you finish remove the file that you created in the previous stage.
Also there is a link (http://kaziprogrammingblog.osinweb.com/article/showarticle/Resetting-MySql-Password) where I have explained the same thing.
Hope this will help..:)
Answer for XAMPP on Windows:
Edit C:\xampp\mysql\bin\my.ini and insert skip-grant-tables below [mysqld]
Restart MySQL from Control Panel interface
In the phpMyAdmin window, select SQL tab from the top panel. This will open the SQL tab where we can run the SQL queries. Now type the following query in the text area and click Go
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;
Remove the skip-grant-tables in the my.ini file
Restart MySQL from Control Panel interface
DONE!
Be awared that mysql root user password does not have to be the same as password for phpmyadmin.
here is what I did and it worked:
After you install (rpm installation), do a vi /etc/my.cnf.
This will give you a path where your datadir is set. For me it was datadir=/var/lib/mysql.
Add a line there user=root, and remove all the content inside the datadir path: rm -rf /var/lib/mysql/*.
Now hit the command: mysqld --initialize.
A temporary password is generated at a location. For this:
grep "A temporary password" /var/log/*.
You will get a line that says:
/var/log/mysqld.log:2018-05-01T15:13:47.937449Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root#localhost: &uosjoGfi9:K. So for me &uosjoGfi9:K was my temporary password.
Now do a mysql -u root -p. Paste your temporary password from what you got from above.
You will be in your mysql cli mode. Now do:
mysql> use mysql;
You will be asked to reset your password:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Run your ALTER command:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPswd';
And you are done.
in my case its a frustrating Windows Server installation (iis/php/mysql) so this is what i did:
PART 1: remove the old MYSQL :
NOTE: if you already have data you should back it up!
Step 1
Uninstall MySQL from Control Panel. (you should know how to do this)
Step 2
Run Command Prompt as Admini and execute the following commands to stop and remove MySQL service.
Net stop MySQL
Sc delete MySQL
Step 3
Delete these folders:
C:\Program Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
And if it exists:
C:\Users\[User-Name]\AppData\Roaming\MySQL
PART 2: Install MYSQL
Download installer from https://dev.mysql.com/downloads/installer/ and install
-MySQL Server 8.0.23
open cmd as admin and go to
c:\Program Files\MySQL\MySQL Server 8.0\bin\
run
mysqld --initialize --console
mysqld --install
now start the service (type services.msc in run panel)
now back to console run:
mysql -u root -p
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
that's it
mysql80:
update user SET authentication_string='your password after encode to sha256' where User='root';