Mysql Mac Install

  

Installing MySQL on a Mac is easier than you might expect, particularly if you use the native installation package instead of the TAR package, which requires access and changes to. Install Docker. Download the (free) Docker Community Edition for Mac (unless you’ve already got it installed on your system). This will enable you to run SQL Server from within a Docker container. To download, visit the Docker CE for Mac download page and click Get Docker.

Active5 months ago

Mac OS X Server comes with MySQL pre-installed. For instructions on how to enable MySQL, see Setup on Mac OS X Server. Installing MySQL on a Virtual Private Server (VPS) Slicehost Articles. Install MySQL on Ubuntu Hardy Install MySQL on CentOS Install MySQL on Debian Lenny Install MySQL on Debian Etch. For additional information, see Section 2.4.3, “Installing a MySQL Launch Daemon”, and Section 2.4.4, “Installing and Using the MySQL Preference Pane”. Use the MySQL Preference Pane or launchd to configure MySQL to automatically start at bootup.

I want to install the MySQL client for the command line, not a GUI. I have searched over the web but only found instructions on installing the MySQL server.

Michael Lihs
2,8976 gold badges29 silver badges55 bronze badges
hchhch
1,4996 gold badges14 silver badges21 bronze badges

13 Answers

user1659189user1659189
1,5271 gold badge10 silver badges4 bronze badges

If you have already installed MySQL from the disk image (dmg) from http://dev.mysql.com/downloads/), open a terminal, run:

then, reload .bash_profile by running following command:

You can now use mysql to connect to any mysql server:

Credit & Reference: http://www.gigoblog.com/2011/03/13/add-mysql-to-terminal-shell-in-mac-os-x/

Michael Lihs
2,8976 gold badges29 silver badges55 bronze badges
JackSparrowJackSparrow
Michael Lihs
2,8976 gold badges29 silver badges55 bronze badges
GeekGeek

Mysql has a client-only set of utilities:

Mysql client shellhttps://dev.mysql.com/downloads/shell/

Other command line utilitieshttps://dev.mysql.com/downloads/utilities/

Mac OSX version available.

trosemantroseman

There is now a mysql-client formula.

brew install mysql-client

egzeegze

Open the 'MySQL Workbench' DMG file and

Eject the DMG disk

caccialdocaccialdo

There is a Homebrew formulae for just a client: https://formulae.brew.sh/formula/mysql-client

Install it by: brew install mysql-client

IvanIvan
4,3344 gold badges38 silver badges55 bronze badges

For installing mysql-shell with homebrew, run

you can then launch the mysql shell with

if you want to enter SQL mode directly, run

Michael LihsMichael Lihs
2,8976 gold badges29 silver badges55 bronze badges

This strictly installs a command line client, without the other overhead:

Install Homebrew (if you don't have it):

Then, install mysql-client:

Then, add the mysql-client binary directory to your PATH:

Finally, reload your bash profile:

Then you should be able to run mysql in a terminal, if not try opening a new terminal

Alex WAlex W
29.1k7 gold badges74 silver badges87 bronze badges

If you installed from the DMG on a mac, it created a mysql client but did not put it in your user path.

Add this to your .bash_profile:

5.7

This will let you run mysql from anywhere as you.

Michael Lihs
2,8976 gold badges29 silver badges55 bronze badges
Paul KenjoraPaul Kenjora

As stated by the earlier answer you can get both mysql server and client libs by running

brew install mysql.

There is also client only installation. To install only client libraries run

brew install mysql-connector-c

In order to run these commands, you need homebrew package manager in your mac. You can install it by running

/usr/bin/ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'

Kimmo HintikkaKimmo Hintikka
2,2044 gold badges22 silver badges40 bronze badges

The easiest way would be to install mysql server or workbench, copy the mysql client somewhere, update your path settings and then delete whatever you installed to get the executable in the first place.

WillaWilla

Mysql Mac Install Location

Using MacPorts you can install the client with:

You also need to select the installed version as your mysql

The server is only installed if you append -server to the package name (e.g. mysql57-server)

Alex GAlex G

protected by Bhargav RaoMay 24 '17 at 7:51

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged mysqlmacosterminal or ask your own question.

In the first of a series of MySQL articles, we will discover how easy it is to install the database system on your development PC.

Why MySQL?

MySQL is undoubtedly the most popular and widely-used open source database:

  • it is simple to set up and use
  • it is recognised as one of the fastest database engines
  • most Linux (and many Windows-based) web hosts offer MySQL
  • MySQL is closely integrated with PHP, which makes it an ideal candidate for many web applications.

Mysql Mac Uninstall

Why Install MySQL Locally?

Installing MySQL on your development PC allows you to safely create and test a web application without affecting the data or systems on your live website (I will cover installing a web server and PHP in a later articles).

This article describes how to install MySQL on Windows, but versions are available for Mac, Linux, and several other operating systems.

All-in-One packages

There are some excellent all-in-one Windows distributions that contain Apache, PHP, MySQL and other applications in a single installation file, e.g. XAMPP, WampServer and Web.Developer. There is nothing wrong with using these packages, but manually installing MySQL will help you learn more about the system and give you more control.

The MySQL Installation Wizard

An excellent .msi installation wizard is available for MySQL. The wizard creates the my.ini configuration file and installs MySQL as a service. This option is certainly recommended for novice users or perhaps those installing MySQL for the first time.

Manual Installation

Manual installation offers several benefits:

  • backing up, reinstalling, or moving databases can be achieved in seconds (see 8 Tips for Surviving PC Failure)
  • you have more control over how and when MySQL starts
  • you can install MySQL anywhere, such as a portable USB drive (useful for client demonstrations).

Step 1: download MySQL
Download MySQL from dev.mysql.com/downloads/. Follow MySQL Community Server, Windows and download the “Without installer” version.

As always, virus scan the file and check the its MD5 checksum using a tool such as fsum.

Step 2: extract the files
We will install MySQL to C:mysql, so extract the ZIP to your C: drive and rename the folder from “mysql-x.x.xx-win32” to “mysql”.

MySQL can be installed anywhere on your system. If you want a lightweight installation, you can remove every sub-folder except for bin, data, scripts and share.

Step 3: move the data folder (optional)
I recommend placing the data folder on another drive or partition to make backups and re-installation easier. For the purposes of this example, we will create a folder called D:MySQLdata and move the contents of C:mysqldata into it.

You should now have two folders, D:MySQLdatamysql and D:MySQLdatatest. The original C:mysqldata folder can be removed.

Step 4: create a configuration file
MySQL provides several configuration methods but, in general, it is easiest to to create a my.ini file in the mysql folder. There are hundreds of options to tweak MySQL to your exact requirements, but the simplest my.ini file is:

(Remember to change these folder locations if you have installed MySQL or the data folder elsewhere.)

Step 5: test your installation
The MySQL server is started by running C:mysqlbinmysqld.exe. Open a command box (Start > Run > cmd) and enter the following commands:

This will start the MySQL server which listens for requests on localhost port 3306. You can now start the MySQL command line tool and connect to the database. Open another command box and enter:

This will show a welcome message and the mysql> prompt. Enter “show databases;” to view a list of the pre-defined databases.

Step 6: change the root password
The MySQL root user is an all-powerful account that can create and destroy databases. If you are on a shared network, it is advisable to change the default (blank) password. From the mysql> prompt, enter:

You will be prompted for the password the next time you start the MySQL command line.

Enter “exit” at the mysql> prompt to stop the command line client. You should now shut down MySQL with the following command:

Step 7: Install MySQL as a Windows service
The easiest way to start MySQL is to add it as a Windows service. From a command prompt, enter:

Open the Control Panel, Administrative Tools, then Services and double-click MySQL. Set the Startup type to “Automatic” to ensure MySQL starts every time you boot your PC.

Mac Install Mysql Client

Alternatively, set the Startup type to “Manual” and launch MySQL whenever you choose using the command “net start mysql”.

Note that the Windows service can be removed using:

Mysql Mac Install Command

See also: