Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sathishmanohar/179750f086c2728266ba9c6a68f527a0 to your computer and use it in GitHub Desktop.
Save sathishmanohar/179750f086c2728266ba9c6a68f527a0 to your computer and use it in GitHub Desktop.
Logging in with command line
============================
When password is not set with the below method. always use `sudo mysql -u root -p` for the login prompt.
Unless password is not set, login won't work without sudo
Reset password instructions here
================================
https://stackoverflow.com/questions/16556497/how-to-reset-or-change-the-mysql-root-password/51023379#51023379
MYSQL-SERVER >= 5.7
sudo mysql -uroot -p
USE mysql;
UPDATE user SET authentication_string=PASSWORD('YOUR_PASSWORD') WHERE User='root';
UPDATE user SET plugin="mysql_native_password";
FLUSH PRIVILEGES;
quit;
MYSQL-SERVER < 5.7
sudo mysql -uroot -p
USE mysql;
UPDATE user SET password=PASSWORD('YOUR_PASSWORD') WHERE User='root';
UPDATE user SET plugin="mysql_native_password";
FLUSH PRIVILEGES;
quit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment