Skip to content

Instantly share code, notes, and snippets.

@abheist
Forked from pratos/mysql_install.md
Created December 18, 2019 06:48
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 abheist/edae04c690e6c91c71d258d9c4efb9b5 to your computer and use it in GitHub Desktop.
Save abheist/edae04c690e6c91c71d258d9c4efb9b5 to your computer and use it in GitHub Desktop.
Uninstall MySQL already present in Digital Ocean(Ubuntu 16.04 LTS) and install-setup again

Installing MySQL 5.7 in Ubuntu 16.04LTS (Note: Things still break in Ubuntu, advisable to move to docker and setup volumes_)

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.7 mysql-client-core-5.7
sudo rm -rf /etc/mysql /var/lib/mysql

Clean-up

sudo apt-get autoremove
sudo apt-get autoclean

Update-Upgrade

sudo apt update
sudo apt upgrade

sudo apt install mysql-server
sudo apt install mysql-client

sudo mysql_secure_installation
# Follow the questions and proceed accordingly

mysql -u root -p
# To login the first time
# Create a database and also create a user that we would be using to put in our Flask ORM

mysql> CREATE database <database>;
mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
mysql> FLUSH PRIVILEGES;

Relogin the mysql shell with

mysql -u newuser -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment