MySQL UseCase

Use Case

  • Show version
  • Show table structure
  • List database
  • Create database
  • Show version

    After connecting, we can use status command;


    Show table structure


    desc table_name;

    You can see Schema of this table.

    List database

    show databases;

    Create database

    create database myapp;

    Show User List

    After access database

    SELECT User,Host from mysql.user;

    Only User and Host, it’s easy to see.

    Create user with all permission

    GRANT ALL ON *.* TO 'ito'@'localhost' IDENTIFIED BY 'itopass';

    ‘ito’ is user name, ‘itopass’ is password
    FLUSH PRIVILEGES is flush mysql grant table.