02-05-2021



  1. Mamp Mysql Command Line Tutorial
  2. Mamp Mysql Command Line Functions

This was a common problem with past versions of MAMP and it continues to happen for some users in version 4.x. Fortunately, the fix is easy. The problem is that when exiting MAMP the MySQL processes continue to run and are not stopped. This post has two solutions. The first solution of killing running processes has worked for me pretty much all the time. The second solution is from one of the comments below.

When using MAMP and the phpMyAdmin interface provided, there may be times when you struggle to import and export large databases, perhaps due to timeout issues. Importing and Exporting Databases in MAMP using a command line interface will eradicate any problems. It appears that it is using a 'different' mysql. I.e., databases I create via the command line aren't viewable in MAMP's phpmyadmin, and vice versa. How can I access MAMP's mysql via the command line? I'm guessing that I need to specify the host when logging in with the mysql command, but I'm not sure what to. In this Lucid Nerd video I will cover how to set up the MySQL database server that was included with MAMP on the command line in Mac OSX.LINKS:LUCID NERD LIN. MAMP PRO Mac MAMP PRO. Nginx: Apache, Nginx: Database Server: MySQL: MySQL: MySQL: Programming Languages. Languages available on the command line: Number of PHP. Using MYSQL with MAMP. Step 1: Start MAMP which will display this window.Click on the middle button to bring up the Start Page. Step 2: The mac and PC version of this page may look different but both have the same link under the MySQL section in the middle.Click on the link for phpMyAdmin. Step 3: phpMyAdmin will look like this.

  1. Quit MAMP. You may have to force quit when this happens as it does not shut down correctly.
  2. To show any MySQL processes currently running, open Terminal and from the command prompt run the command below.
  3. Next, kill the MySQL processes by running the command below.
  4. To verify they no longer exist, pgrep for mysql again and you should not have any processes returned.
  5. Now Launch MAMP again and MySQL Server should start normally.

Alternative Solution

If the above solution does not work, this method should.

Mamp Mysql Command Line Tutorial

  1. Stop Mamp and kill the mysql processes as above.
  2. Rename the ib_logfileN (N is the log numbers) files to something else. Don’t delete these as you may need to return to them. The path to these files may be different on your system. On my system, I would do the following:
  3. Restart MAMP and MySQL should start correctly.
    (Thanks to Daniel Erkalo for this alternative fix!)

Mamp Mysql Command Line Functions

Using MAMP’s MySQL Server in Terminal #

When installing Craft on the command line, your terminal session needs to use MAMP’s MySQL server. Edit the .bash_profile file from the previous section and add MAMP’s MySQL path:

Command

Now terminal will look for mysql in MAMP’s bin directory first. You can also run mysql and mysqldump commands on MAMP’s database when you need to. Close your terminal session and open a new one. Don’t forget start MAMP’s MySQL server if it’s not already running.

Set Important php.ini Values #

MAMP runs slowly compared to production servers, so it needs extra time to do things. It also needs plenty of memory allocated to PHP. Edit the php.ini file for the version of PHP your Craft site is running. Go to File > Edit > Edit Template > PHP (php.ini) and select the version of PHP you’re using.

  • Find max_execution_time and set it to 60 or higher
  • Find memory_limit and set it to 256M or higher
  • Save and close the file
  • Restart MAMP

Be kind to yourself and do that for all of MAMP’s PHP versions. Do use MAMP’s own php.ini editor. If you’re tempted to find and edit the correct php.ini in the file system on your own… good luck.