![]() However, you need to refresh your terminal (open another session) to get this file refreshed. (Note: you need to check "Make this version available on the command line" option in MAMP) Just be aware that your aliases might not be available from subshells (like when executing a shell script).Įverytime you save MAMP config (PHP section), it saves the current version of PHP on ~/.profile file and creates the alias for php, pear and pecl, to point to the current configured version. Note: points out that zsh doesn’t support exporting functions, so in that case, you’re best off using an alias, like alias mysql='/Applications/MAMP/Library/bin/mysql'. If you want to check which mysql is being used and make sure everything is copacetic, use mysql -version instead. The only downside I’ve found is that running which mysql and which mysqladmin will no longer return anything, which is a bummer. I used functions instead of aliases, because aliases don’t get passed to child processes, or at least not in the context of a shell script. Applications/MAMP/Library/bin/mysqladmin -f mysql # Makes them usable from within shell scripts (unlike an alias) My solution was to define and export mysql and mysqladmin as functions: # Export MAMP MySQL executables as functions This issue prevented me from installing a node package recently (libxmljs), as documented here. However, I do not recommend exporting that folder, because there are a bunch of other executables there, like libtool, that you probably don’t want to be giving priority to over your system installed versions. (Use source ~/.bash_profile after making your changes to make sure they take effect.)Īs others have mentioned, you will likely also want to modify your shell to use MAMP’s mysql executable, which is located in /Applications/MAMP/Library/bin. PHP_VERSION=`command ls /Applications/MAMP/bin/php/ | sort -n | tail -1`Įxport PATH=/Applications/MAMP/bin/php/$/bin:$PATH Here’s how I do it: # Use MAMP version of PHP zshrc to get the latest version of PHP from /Applications/MAMP/bin/php/ and export that to your path. You can make your path update automatically by adding an extra line to your. ![]() If you didn’t change it, it’s root, otherwise it’s the one you set after installing MAMP.The fact that the previously accepted answer refers to php 5.3.6, while the current version of MAMP ships with 7.2.1 as the default (as of early 2018), points out that this is not a very sustainable solution. Now you should be able to use mysql alias. bash_profile is executed every time you log in, we have to reload the content without rebooting. Last step – force the change you’ve done to take effect. alias mysql='/Applications/MAMP/Library/bin/mysql -u root -p' If you did, change it to a proper location). When an edit window will appear, type the following line (I assume that you didn’t change the default path where MAMP is installed. Open terminal and go to you home directory cd ~ ![]() In this article I will show you, how can we create an alias and access MySQL much faster. To achieve the same as above you have to type /Applications/MAMP/Library/bin/mysql -u root -p Since the path is long (see below), it’s not a convenient way. In OS X you have to provide full path to MySQL. On of the things that can become little bit frustrating is that when normally you would like to access MySQL, you would type mysql -u root -p It’s very handy when you have to deal with importing or exporting huge SQL files. After MAMP is installed on OS X, you can use command line (terminal) to access MySQL in exactly the same way as on Linux. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |