Mysql Command Line Cheat Sheet



This article introduces some basic MySql database concepts including definitions, database connections sql, sql to import and create a MySql database.

The examples will use the mysql> command line (as opposed to phpmyadmin).

Some Definitions

The programming language SQL is the primary tool used to communicate with your MySQL database. Therefore, to create, modify, and work with relational databases, you need to run the appropriate SQL commands. In this tutorial, you will find the most important MySQL commands as well as a downloadable cheat sheet. MySQL Pager - Output Handling. You can get a very simple status by just entering ' s' in the 'mysql' command line client prompt: mysql s.

  1. RDBMS : Relational Database Management System eg mySQL
  2. Users: Users can interact with one or more databases on the RDBMS.
  3. Schema: A database schema of a database system is its structure described in a formal language supported by the database management system (DBMS). The term “schema” refers to the organization of data as a blueprint of how the database is constructed (divided into database tables in the case of relational databases).In MySQL, physically, a schema is synonymous with a database. You can substitute the keyword SCHEMA instead of DATABASE in MySQL SQL syntax, for example using CREATE SCHEMA instead of CREATE DATABASE.

    Some other database products draw a distinction. For example, in the Oracle Database product, a schema represents only a part of a database: the tables and other objects owned by a single user.

Mysql

MySQL Command Line

MySQL ROOT PASSWORD
This is blank as a default.

CONNECT TO DATABASE SERVER

  • -u {mysql-user} : Specify MySQL user name. Use root only when connecting to local system.
  • -p {mysql-password}: Specify password, Employ the specified password when connecting to the database server. If a password is not supplied, it will be requested interactively.
  • -h {mysql-server}: Connect to the specified host (remote or local)
Examples

eg

CREATE DATABASE

From within the mysql program:

Line

SHOW ALL DATABASES

From within the mysql program:

IMPORT DUMP:

Will prompt for password

Mssql Cheat Sheet

Mysql Command Line Cheat Sheet

Mysql Cheat Sheet Pdf

CREATE USER FOR DATABASE

eg

Mysql Command Line Cheat Sheet Tutorial

then reload the privileges:

Mysql 8.0 Command Line Client

SHOW ALL USERS