Install Mysql Mac Catalina

Documentation

  • Getting Started
  • Reference
  • Bundles
  • Contribute
  • I install MYSQL on my Mac (Catalina) via the homebrew. It works but I wanna install both MYSQL5.7 and MYSQL8.0, homebrew didn't help Is there any instruction for Mac please guide me?
  • Sorry, only registered users may post in this forum. Click here to login. Content reproduced on this site is the property of the respective copyright holders.

Setting up MySQL. I am on a Mac OS system using version Catalina. To have MySQL running on my machine I had to install the following tools; MySQL community server download link; MySQL workbench download link; If you are on a windows machine you can use the same tools or you can use XAMPP as well. Installing MySQL.

For Beginners

Mac OS X doesn't ship with its own copy of MySQL, nor does Sequel Pro. You will have to install a copy on your local machine, or connect to the MySQL server on a machine somewhere on the Internet.

Most webservers and website packages will include a MySQL installation as part of the services they provide, and usually provide external connection details to allow you to connect to them in an external program like Sequel Pro. (See Web Hosting Providers for a list of hosting options).

There are several different ways to install MySQL on Mac OS X. We have provided links to the most common installation methods for Mac OS X.

Using the official .pkg installer

This is the fastest method for installing MySQL on your Mac, but only available for Intel processors. MySQL.com offers a standard MacOS installer package that installs the MySQL Server and several command line utilities. The download also includes a system preference pane for starting/stopping the server. You can optionally install a startup item that starts the MySQL server when your computer starts. The download weighs about 70MB.

MySQL 5.0 for Mac OS X — for MacOS 10.4-10.5, Intel only
MySQL 5.1 for Mac OS X — for MacOS 10.4-10.6, Intel only, recommended Version
MySQL 5.5 for Mac OS X — for MacOS 10.4-10.6, Intel only

MAMP / XAMPP on Mac OS X

Install Mysql 5.6 Mac Catalina

MAMP and XAMPP are complete web development packages. They are designed to give developers an easy way to serve up PHP pages using Apache and MySQL right on their Mac. The two packages differ in the selection of utilities they include, but both of them include their own version of Apache, MySQL, and PHP.

These packages are installed by copying the MAMP/XAMPP folder to your applications folder. There are no hidden files and both packages are trivial to uninstall — just drag the MAMP/XAMPP folder to the trash.

MAMP includes a GUI utility for starting and stopping the servers. The utility also allows basic configuration of the servers, including the port MySQL runs on (default is 8889). There is a commercial utility (named MAMP PRO) available for more advanced options. MAMP includes PHP 4 and 5.2, and MySQL 5.1. The download is about 160MB.

Download MAMP/MAMP Pro — for MacOS 10.4-10.6, Universal binary

XAMPP provides only a utility for starting/stopping the servers. Configuration is performed using command line utilities. XAMPP includes PHP 5.3, MySQL 5.1, and several extras like Perl and an FTP Server. XAMPP weighs in at about 90MB.

Download XAMPP — for MacOS 10.4-10.6, Universal binary

If you use one of these packages, see Connecting to MAMP or XAMPP for further instructions.

Install from Source

Installing a copy of MySQL from source is recommended for advanced users only. There are many advantages to compiling your own copy of MySQL — including speed improvements and system specific customisations (eg. for machines with little RAM). Installation from source also gives you access to cutting edge features and bugfixes before a .pkg installer is available.

You must have the Xcode Developer Tools installed. Compiling takes a very long time compared to installing binaries, but you'll only have to download about 20MB of source code.

Installing from source — MySQL
Tutorial for Tiger and Leopard — Hive Logic
Tutorial for Snow Leopard — Hive Logic

Using MacPorts

If you want to install from source, but spare yourself the hassle of configuring the install, you can use Macports to automatically compile and install MySQL. This method works only if you have MacPorts and the XCode Developer Tools installed. The MySQL download is aproximately 20MB plus dependencies.

With MacPorts you can install the MySQL Server by typing the following command in Terminal:

Afterwards, you must run:

Install Mysql 5.7 Mac Catalina

Start MySQL:

Stop MySQL:

Mac OS X Server comes with MySQL pre-installed. For instructions on how to enable MySQL, see Setup on Mac OS X Server.

Slicehost Articles

Install MySQL on Ubuntu Hardy
Install MySQL on CentOS
Install MySQL on Debian Lenny
Install MySQL on Debian Etch

Question or issue on macOS:

I’m trying to setup up MySQL on mac os 10.6 using Homebrew by brew install mysql 5.1.52.

Everything goes well and I am also successful with the mysql_install_db.
However when I try to connect to the server using:

I get:

I’ve tried to access mysqladmin or mysql using -u root -proot as well,
but it doesn’t work with or without password.

This is a brand new installation on a brand new machine and as far as I know the new installation must be accessible without a root password. I also tried:

but I also get

How to solve this problem?

Solution no. 1:

I think one can end up in this position with older versions of mysql already installed. I had the same problem and none of the above solutions worked for me. I fixed it thus:

Used brew’s remove & cleanup commands, unloaded the launchctl script, then deleted the mysql directory in /usr/local/var, deleted my existing /etc/my.cnf (leave that one up to you, should it apply) and launchctl plist

Updated the string for the plist. Note also your alternate security script directory will be based on which version of MySQL you are installing.

Step-by-step:

I then started from scratch:

  1. installed mysql with brew install mysql
  2. ran the commands brew suggested: (see note: below)

  3. Start mysql with mysql.server start command, to be able to log on it

  4. Used the alternate security script:

  5. Followed the launchctl section from the brew package script output such as,

Note: the --force bit on brew cleanup will also cleanup outdated kegs, think it’s a new-ish homebrew feature.

Note the second: a commenter says step 2 is not required. I don’t want to test it, so YMMV!

Solution no. 2:

Here are detailed instructions combining getting rid of all MySQL from your Mac then installing it The Brew Way as Sedorner wrote above:

Remove MySQL completely per The Tech Lab
  • ps -ax | grep mysql
  • stop and kill any MySQL processes
  • sudo rm /usr/local/mysql
  • sudo rm -rf /usr/local/var/mysql
  • sudo rm -rf /usr/local/mysql*
  • sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • sudo rm -rf /Library/StartupItems/MySQLCOM
  • sudo rm -rf /Library/PreferencePanes/My*
  • launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  • rm -rf ~/Library/PreferencePanes/My*
  • sudo rm -rf /Library/Receipts/mysql*
  • sudo rm -rf /Library/Receipts/MySQL*
  • sudo rm -rf /private/var/db/receipts/*mysql*
  • sudo rm -rf /tmp/mysql*
  • try to run mysql, it shouldn’t work
Brew install MySQL per user Sedorner from this StackOverflow answer
  • brew doctor and fix any errors

  • brew remove mysql

  • brew cleanup

  • brew update

  • brew install mysql

  • unset TMPDIR

  • mysql.server start

  • run the commands Brew suggests, add MySQL to launchctl so it automatically launches at startup

mysql should now work and be running all the time as expected

Godspeed.

Solution no. 3:

Had the same problem. Seems like there is something wrong with the set up instructions or the initial tables that are being created. This is how I got mysqld running on my machine.

How to install mysql on macos catalina

If the mysqld server is already running on your Mac, stop it first with:

launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist

Start the mysqld server with the following command which lets anyone log in with full permissions.

mysqld_safe --skip-grant-tables

Install Mysql Mac Catalina Software

Then run mysql -u root which should now let you log in successfully without a password. The following command should reset all the root passwords.

UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE User='root'; FLUSH PRIVILEGES;

Now if you kill the running copy of mysqld_safe and start it up again without the skip-grant-tables option, you should be able to log in with mysql -u root -p and the new password you just set.

Solution no. 4:

Install mysql mac catalina software

If brew installed MySQL 5.7, the process is a bit different than for previous versions.
In order to reset the root password, proceed as follows:

A temporary password will be printed to the console and it can only be used for updating the root password:

Solution no. 5:

Okay I had the same issue and solved it. For some reason the mysql_secure_installation script doesn’t work out of the box when using Homebrew to install mysql, so I did it manually. On the CLI enter:

That should get you into mysql. Now do the following (taken from mysql_secure_installation):

Now exit and get back into mysql with: mysql -u root -p

Solution no. 6:

I had the same problem just now. If you brew info mysql and follow the steps it looks like the root password should be new-password if I remember correctly. I was seeing the same thing you are seeing. This article helped me the most.

It turned out I didn’t have any accounts created for me. When I logged in after running mysqld_safe and did select * from user; no rows were returned. I opened the MySQLWorkbench with the mysqld_safe running and added a root account with all the privs I expected. This are working well for me now.

Solution no. 7:

If mysql is already installed

Stop mysql completely.

  1. mysql.server stop <– may need editing based on your version
  2. ps -ef | grep mysql <– lists processes with mysql in their name
  3. kill [PID] <– kill the processes by PID

Remove files. Instructions above are good. I’ll add:

  1. sudo find /. -name '*mysql*'
  2. Using your judgement, rm -rf these files. Note that many programs have drivers for mysql which you do not want to remove. For example, don’t delete stuff in a PHP install’s directory. Do remove stuff in its own mysql directory.

Install

Hopefully you have homebrew. If not, download it.

Install Apache Php Mysql Mac Catalina

I like to run brew as root, but I don’t think you have to. Edit 2018: you can’t run brew as root anymore

  1. sudo brew update
  2. sudo brew install cmake <– dependency for mysql, useful
  3. sudo brew install openssl <– dependency for mysql, useful
  4. sudo brew info mysql <– skim through this… it gives you some idea of what’s coming next
  5. sudo brew install mysql --with-embedded; say done <– Installs mysql with the embedded server. Tells you when it finishes (my install took 10 minutes)

Afterwards

  1. sudo chown -R mysql /usr/local/var/mysql/ <– mysql wouldn’t work for me until I ran this command
  2. sudo mysql.server start <– once again, the exact syntax may vary
  3. Create users in mysql (http://dev.mysql.com/doc/refman/5.7/en/create-user.html). Remember to add a password for the root user.

Solution no. 8:

Install Mysql Mac Catalina Operating System

brew info mysql

Install

mysql.service start

or mysql -u root

I’m looking for a solution for some time but I can not solve my problem. I tried several solutions in stackoverflow.com but no this helping me.

Solution no. 9:

TL;DR

MySQL server might not be running after installation with Brew. Try brew services start mysql or just mysql.server start if you don’t want MySQL to run as a background service.

Full Story:

Install Mysql Mac Catalina

I just installed MySQL (stable) 5.7.17 on a new MacBook Pro running Sierra and also got an error when running mysql_secure_installation:

Say what?

According to the installation info from Brew, mysql_secure_installation should prompt me to… secure the installation. I figured the MySQL server might not be running and rightly so. Running brew services start mysql and then mysql_secure_installation worked like a charm.

Solution no. 10:

Here is an update for MySQL 5.7

Hope this helps!