Installing MySQL In MAC OSX

With brew

brew install mysql

The above command installs the latest version of mysql, but if you need to install a specific version of mysql, you would use the following:

brew install mysql@5.7

After successful installation, you will see the following:

We've installed your MySQL database without a root password. To secure it run:

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start

-bash: fork: retry: Resource temporarily unavailable

If you are getting the above error in a Linux machine, you are probably hitting some resource limit in your shell. Every user in Linux has some limit on shell resources. You can check your resources limit with the following command:

ulimit -a

whose result may look like the following:

As you can see, the limit on “max user processes” is 1024, which means if I create more than 1024 processes, I might get the error : “-bash: fork: retry: Resource temporarily unavailable”.

To resolve the issue, you can temporarily increase the limit on the resource you have currently exhausted and then resolve the issue. Next time you log in to the machine, the resource you have increased will reset to its default value. You can modify the shell with the same commands that are shown in the figure. For example, if I want to increase the resource on “max user processes” to 2048, I can do so by running the following command:

ulimit -u 2048