Collection of sql cli command for beginning.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md

README.md

SQLCommandLine

How to Install MySQL on Ubuntu and CentOS

If you don't have MySQL installed on your droplet, you can quickly download it.
sudo apt-get install mysql-server

How to Access the MySQL shell

Once you have MySQL installed on your droplet, you can access the MySQL shell by typing the following command into terminal:
mysql -u root -p

while starting sql problem on linux and Kali (through Socket)

Please run these command
ps -A|grep mysql
sudo pkill mysql
ps -A|grep mysqld
sudo pkill mysqld
service mysql restart
mysql -u root -p

Show All USERS

SELECT * FROM mysql.user;

Create USER

CREATE USER 'widget_cms'@'localhost' IDENTIFIED BY 'mypass'

Show Database

SHOW DATABASES;

Create Database

CREATE DATABASE IF NOT EXISTS widget_db

GRANT Privilegs

GRANT ALL ON widget_db.* TO 'widget_cms'@'localhost'

FLUSH

FLUSH PRIVILEGES

SHOW GRANTS FOR USER

SHOW GRANTS FOR 'widget_cms'@'localhost'
Grants for widget_cms@localhost
GRANT USAGE ON *.* TO 'widget'@'localhost' IDENTIFIED BY PASSWORD '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4'
GRANT ALL PRIVILEGES ON `foo`.* TO 'admin'@'localhost'

DROP USER

DROP USER 'widget_cms'@'localhost'

DROP DATABASE

DROP DATABASE IF EXISTS widget_db

USE DATABASE

Use widegt_db;

Create Table

CREATE TABLE admin ( id INT(11) NOT NULL AUTO_INCREMENT, username varchar(50) NOT NULL, hash_password varchar(60) NOT NULL, primary key (id) );