mysql.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Tue, 29 Dec 2015 22:38:28 +0200
changeset 1849 a3b639d803e7
parent 1836 4864231db031
child 1850 84707c692266
permissions -rw-r--r--
System information.

.. -*- coding: utf-8; -*-
.. include:: HEADER.rst

================
 MySQL/MariaBD.
================
.. contents::

SQL clients.
============

  https://mariadb.com/kb/en/mariadb/clients-and-utilities/
     Clients and Utilities.
  https://mariadb.com/kb/en/mariadb/graphical-and-enhanced-clients/
     Graphical and Enhanced Clients.

mysql.
------

Official client. Install ``mariadb-client`` package - ``mysql`` utility
will be installed with dependent package.

Usage::

  $ mysql -u $USER -p
  Enter password:   <== Type password.

mycli.
------

Python command line client with completion. Usage::

  $ mycli -u $USER
  Password:         <== Type password.

List databases, tables, columns.
================================
::

  $ mysql -u $USER -p
  Enter password:   <== Type password.

  SHOW DATABASES;

  USE mysql;
  MariaDB [mysql]> SHOW TABLES;

  MariaDB [mysql]> SHOW COLUMNS FROM user;

  MariaDB [mysql]> DESCRIBE user;

  MariaDB [mysql]> SHOW STATUS;

  MariaDB [mysql]> SHOW CREATE DATABASE mysql;
  MariaDB [mysql]> SHOW CREATE TABLE user;

  MariaDB [mysql]> SHOW GRANTS;

System information.
===================

Server version, platform, etc::

  [mysql]> SHOW VARIABLES LIKE "%version%";

Debugging.
==========

After error or warning run::

  MariaDB [mysql]> SHOW WARNINGS;
  MariaDB [mysql]> SHOW ERRORS;
  MariaDB [mysql]> show engine innodb status;