Skip to content

Instantly share code, notes, and snippets.

@stefanopulze
Last active March 4, 2019 21:41
Show Gist options
  • Select an option

  • Save stefanopulze/eb8a3b5069df5e7ecab6a0fb1d2e6b06 to your computer and use it in GitHub Desktop.

Select an option

Save stefanopulze/eb8a3b5069df5e7ecab6a0fb1d2e6b06 to your computer and use it in GitHub Desktop.
Useful mysql commands
# connect
mysql -u root -p
# List databases
show databases;
# create database
create database database-name;
# Create user
CREATE USER 'new-user'@'localhost' IDENTIFIED BY 'password';
# Create user can be connected from everywhere
CREATE USER 'new-user'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database-name. * TO 'new-user'@'localhost';
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment