Skip to main content

Tedshd's Dev note

Category: Mysql

Mac M1 run MySQL in local docker

# Usage docker hub In Apple M1 no-official image amd64/mysql MySQL 5.7 docker pull amd64/mysql:5.7 # Run docker in local Sample for M1(different of image name) docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d amd64/mysql:latest Container run in 0.0.0.0 mysql --default-character-set=utf8mb4 -u root -h 0.0.0.0 -P 3306 -p -A ...

MySQL command

# MySQL Monitor ## Setting mysql -u root -h <HOST> -P <PORT> <DATABASE_NAME> -p -A ## database 每一個 command 最後都要加 ; status; create database database_name; drop database database_name; show databases; show tables; use database_name; ## table create table table_name( column1 type1, column2 type2); create table table_name( column1 type1, column2 type2) charset=utf8; desc table_name; show create table <table_name> MySQL 8.0 Reference Manual :: 3.3.2 Creating a Table - MySQL 13.1.20 CREATE TABLE Statement - MySQL :: Developer Zone ...