Skip to content

mysql

Connecting

sudo su
mysql

Basic Commands

/* list databases */
SHOW DATABASES;
/* list tables in database */
SHOW SCHEMAS;
/* Connect database */
USE DATABASE_NAME;
# Docker Compatible
mysql --user=user -p mydb --host=127.0.0.1 -P 3306 < data.sql

mysql --user=root -p deepwork --host=127.0.0.1 -P 3307 < db/script.sql

mysql --user=root -p deepwork --host=127.0.0.1 -P 3307

mysql --user=root -p mydb < data.sql


Allow Remote Connection

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%.%.%.%' 
  IDENTIFIED BY 'Piepie1234.' WITH GRANT OPTION;

wiki.software.list.docker.docker-compose.templates

MySQL :: MySQL Downloads

version: "3"
services:
  mysql:
    image: mysql:5.7
    # volumes:
    #   - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: mydb
      MYSQL_USER: user
      MYSQL_PASSWORD: user
    ports:
      - 127.0.0.1:3306:3306

Errors

Sources