Last active
August 2, 2018 17:51
-
-
Save numoonchld/6c0dbcddc1c7111f1113b70bdeb73136 to your computer and use it in GitHub Desktop.
LAMP Setup - mySQL CheatSheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Install mySQL ------------------------------- | |
sudo mysql_secure_installation | |
# Login to mySQL | |
sudo mysql –u root –p | |
## Setup mySQL databases: ------------------------------- | |
# Create Database for wordpress | |
CREATE DATABASE databaseName; | |
# View list of databases | |
show databases; | |
# Set active database/ Switch database | |
USE databaseName; | |
# Delete a database | |
DROP DATABASE databaseName; | |
## Setup mySQL user: ------------------------------- | |
# See all users | |
select host, user from mysql.user; | |
# Create a user | |
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'set_password'; | |
## Grant user privileges: ------------------------------- | |
# grant new user all privileges | |
GRANT ALL PRIVILEGES ON databaseName.tableName TO 'newuser'@localhost IDENTIFIED BY 'set_password'; | |
# refresh the database | |
FLUSH PRIVILEGES; | |
# exit mySQL | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment