Docker - Command To Run Local MySQL Database Server
👤 By Webune | 📆
Commands: Docker MySQL Server
Use these simple terminal commands to run a local mysql server very easy with Docker inside a container and start using it for your projects:
$ docker run --name ms -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password123 mysql
Use Interacrtive terminal to the access mysql server in docker container.$ docker exec -it ms bash
Loging to MySQL server:$ mysql -u root -p
Create database:mysql> create database laravel_backend_api;
Access the new database we just created:mysql>
use laravel_backend_api;
CREATE A TABLE:
create table employees (id int not null,name text,primary key (id));
INSERT Datainsert into employees (id,name) values (1, "John");
VIEW NEWLY CREATED RECORDS:select * from employees;
OUTPUT:
+----+------+
| id | name |
+----+------+
| 1 | John |
+----+------+
1 row in set (0.00 sec)