Skip to content

Instantly share code, notes, and snippets.

@hussnainsheikh
Forked from JamesDaniel/install_mysql.md
Created September 5, 2019 13:25
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 hussnainsheikh/cfd43f3d8bffac4528977b73570cbd7c to your computer and use it in GitHub Desktop.
Save hussnainsheikh/cfd43f3d8bffac4528977b73570cbd7c to your computer and use it in GitHub Desktop.

How to install mysql on ubuntu (which works)

first delete it in case a root password was previously created:

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

then install it:

then start up the mysql command line:

mysql -u root -p

Create a user:

CREATE USER 'user' IDENTIFIED BY 'mypass';

Then grant privileges:

GRANT ALL PRIVILEGES ON * . * TO 'user'

Then create a database:

CREATE DATABASE dbname;

Or use a database:

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