Let me directly get to the point, Installing MySQL on a local machine can be tricky sometimes. Those of you who have seen this "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)", know what I am talking about.

By the way, you can see how to fix ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) by clicking on the link.

Getting back to the topic. you will need Docker installed in the system and that is it. If you don't have Docker installed you can visit here to get it installed.

Once it is installed, run the following command in your terminal.

docker run --name some-name -p 3306:3306 -e MYSQL_ROOT_PASSWORD=your-password -d mysql

where some-name is your container name and your-password is your root password.

And that's it. your MySql server is up and running in docker.

You can check all the running docker containers by using the following command.

docker ps

To stop your MySql container use the following command

docker stop some-name

To start it you can use the following command.

docker start some-name

Now you connect this mysql server to any DB manager like mysql workbench, dbeaver, etc.