JSS – Setting Path for MySQL on OS X Server

JSS – Setting Path for MySQL on OS X Server

os x yosemite, terminal, mysql logos


This post covers setting the path variable for MySQL on a JAMF Software Server running OS X 10.10.x Server & MySQL 5.6.x. The path for a user in OS X is a set of locations in the file system whereby the user can use certain applications, commands and programs without the need to specify the full path to that command or program in the Terminal.

So instead of entering something like this:


You could just type:


The variable is specified as a list of one or more directory names separated by colon (:) characters.

The “/bin“, “/usr/bin“, and “/usr/local/bin” directories are typically included in most users’ path setting (although this varies from implementation to implementation). The administrator also typically has “/sbin” and “/usr/sbin” entries for easily executing system administration commands.

Output Path

You can output your current path by entering the following command:

echo $PATH

For example, on OS X with JAMF Software Server setup, you might see the following path:

# echo $PATH

Note, the “/Applications/Server.app” paths are for OS X Server application.

Add MySQL Path

To add a path for MySQL, you can create a text file named “mysql” in the following directory:


You can use the following command:

sudo echo "/usr/local/mysql/bin" 〉/etc/paths.d/mysql

Or you can use your favorite text editor and create a file in that location with that path.

BBEdit paths.d directory mysql file

Note, you need a extra line break after the path line, else you will have issues path variable.

For example:

# echo $PATH

Notice, the addition text at the end of the path, “/binbin:/bin“. To fix the issue, open the file in your text editor and make sure there is a extra line break and test the path variable again.

After creating the mysql file, you can list the files in the “/etc/paths.d” directory with the following command:

# ls -al /etc/paths.d/
total 16
drwxr-xr-x    4 root  wheel   136 Dec 21 11:54 .
drwxr-xr-x  111 root  wheel  3774 Nov  2 16:06 ..
-rw-r--r--    1 root  wheel   107 Sep 29  2014 com.apple.server
-rw-r--r--    1 root  wheel    21 Dec 21 12:29 mysql

Note, the file for “com.apple.server” that includes the paths for OS X Server application.

# cat /etc/paths.d/com.apple.server

BBEdit paths.d directory com.apple.server file

Next, to test the path setup, quit and relaunch Terminal and run the following command:

# echo $PATH

And you should be able to just enter “mysql” to work with and options in MySQL.

For example:

# mysql --version
mysql  Ver 14.14 Distrib 5.6.24, for osx10.8 (x86_64) using  EditLine wrapper
No Comments

Leave a Reply