Skip to content

Instantly share code, notes, and snippets.

@achmiral
Forked from SunDi3yansyah/shell.md
Created November 9, 2018 16:59
Show Gist options
  • Save achmiral/80d4d490b908a5ca62e01dc2031a0599 to your computer and use it in GitHub Desktop.
Save achmiral/80d4d490b908a5ca62e01dc2031a0599 to your computer and use it in GitHub Desktop.
MySQL / MariaDB login without SUDO
$ > sudo mysql -uroot
mysql > SELECT User, Host FROM mysql.user;
mysql > DROP USER 'root'@'localhost';
mysql > CREATE USER 'root'@'localhost' IDENTIFIED BY 'STRING-PASSWORD-NYA';
mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
mysql > FLUSH PRIVILEGES;
mysql > exit
$ > mysql -uroot
@armansheikh
Copy link

Thanks for sharing it worked for me in Maria DB 10.1.44

@pOmelchenko
Copy link

pOmelchenko commented Apr 26, 2020

If you want access without password you can skip drop ... and create ... steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment