Skip to content

Instantly share code, notes, and snippets.

@ferdousulhaque
Forked from alexwebgr/shell.sh
Created February 21, 2025 02:05
Show Gist options
  • Save ferdousulhaque/d00e98239903b8c5d0edadfae868a0e1 to your computer and use it in GitHub Desktop.
Save ferdousulhaque/d00e98239903b8c5d0edadfae868a0e1 to your computer and use it in GitHub Desktop.
Install MySQL on ubuntu 20.04 and set the root password
# Completely remove any previous config
sudo apt remove --purge mysql*
sudo apt autoremove
sudo find / -iname mysql
# install the server
sudo apt update
sudo apt install mysql-server
# run the wizard
sudo mysql_secure_installation
sudo mysql
mysql> use mysql;
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
# enable password login
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> exit;
# should be able to login with password now
mysql -u root -p
Enter password:
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment