Menu

Login to MySQL as the MySQL root user

March 23, 2019 - MySql

If you have installed MySQL/MariaDB from base repository, users can not login to MySQL as the MySQL root user from their Unix logins (not applicable if they have sudo access)

  1. Login to MySQL root shell:$ sudo mysql -u root -p
  2. Execute below queries:use mysql; update user set plugin='mysql_native_password' where user='root'; flush privileges; quit;
  3. Open a new shell, then:$ mysql -u root -p

Source

This will set user root with no password

Leave a Reply