Skip to content

Instantly share code, notes, and snippets.

@myusuf3
Created September 14, 2011 02:03
Show Gist options
  • Save myusuf3/1215689 to your computer and use it in GitHub Desktop.
Save myusuf3/1215689 to your computer and use it in GitHub Desktop.
# connect as root to the MySQL server
# all this is saying connect as user 'root' with password i am going to provide.
# you will be prompted for password after you press enter.
mysql -u root -p
# Once you are connected you will be presented with the following prompt
mysql>
# if you want to learn type in
mysql> /h
# otherwise do the following to create a username and password and table.
# create database
CREATE DATABASE testdb;
# create user 'testuser' which can only connect from localhost with password 'changeme'
CREATE USER 'testuser'@localhost IDENTIFIED BY 'changeme';
# you give it permission to create and edit all table in the testdb
GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@localhost;
# you exit mysql
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment