Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

  • Enter the following command : $ brew info mysql
  • Expected output: mysql: stable 5.7.15 (bottled)

To install MySQL enter : $ brew install mysql

Additional configuration

Homebrew

  • Install brew services first : $ brew tap homebrew/services

  • Load and start the MySQL service : $ brew services start mysql.
    Expected output : Successfully started mysql (label: homebrew.mxcl.mysql)

  • Check of the MySQL service has been loaded : $ brew services list 1

  • Verify the installed MySQL instance : $ mysql -V.
    Expected output : Ver 14.14 Distrib 5.7.15, for osx10.12 (x86_64)

MySQL

Open Terminal and execute the following command to set the root password:
mysqladmin -u root password 'yourpassword'

Important : Use the single ‘quotes’ to surround the password and make sure to select a strong password!

Database Management

To manage your databases, I recommend using Sequel Pro, a MySQL management tool designed for macOS.
Current version available: 1.1.2

Comments

1 The brew services start mysql - instruction is equal to :

$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
@marius-v

This comment has been minimized.

Copy link

marius-v commented Dec 30, 2016

thank you!

@Renrhaf

This comment has been minimized.

Copy link

Renrhaf commented Jan 23, 2017

thanks !

@tcelestino

This comment has been minimized.

Copy link

tcelestino commented Jan 30, 2017

If you need to change mysql password, you can look this tutorial: http://www.macminivault.com/install-mysql-on-macos-sierra/

@jacqueline-homan

This comment has been minimized.

Copy link

jacqueline-homan commented Feb 6, 2017

This is NOT working for me. Can somebody help me please?
mysql_notworking4me1
Uploading mysql_notworking4me2.png…
Uploading mysql_notworking4me3.png…
Uploading mysql_notworking4me4.png…
Uploading mysql_notworking4me5.png…
Uploading mysql_notworking4me6.png…
Uploading mysql_notworking4me7.png…
Uploading mysql_notworking4me8.png…
Uploading mysql_notworking4me9.png…
Uploading mysql_notworking4me10.png…

@jacqueline-homan

This comment has been minimized.

Copy link

jacqueline-homan commented Feb 6, 2017

I could really use some help here...

@carlosfcocruz

This comment has been minimized.

Copy link

carlosfcocruz commented Feb 10, 2017

https://gist.github.com/jacqueline-homan you only need to run mysql -u[user] -p[password] it works for me. remember username and password that you set on mysqladmin -u root password 'yourpassword'

@jdforsythe

This comment has been minimized.

Copy link

jdforsythe commented Feb 11, 2017

@jacqueline-homan

The error is because there is a .bash_history file in your home directory that stores all the commands you type. It can be insecure to use your password in the command because it will be saved in that file in plain text. Instead, do this:

$ mysql -uroot

and it will ask for your password, which won't be stored in the .bash_history file.

@puneet-ibm

This comment has been minimized.

Copy link

puneet-ibm commented Feb 25, 2017

I agree with jdforsythe as well that its not a good idea to use your password in command line directly, but if you have already used and want to clear from history, you can use following commands : "history -c" --to clear the history of current session, or "rm ~/.bash_history" --to clear the entire history. You can also open the history file as "vi ~/.bash_history" and can clear out specific lines.

@puneet-ibm

This comment has been minimized.

Copy link

puneet-ibm commented Feb 25, 2017

One additional point i would like to mention here for system's performance, i personally don't want to start MySQL every time i logged in(by a background service) as its consumes system's resources irrespective of the fact that whether i am using it or not. So i would like to start MySQL by myself whenever i need using the command "mysql.server start". Note that you need to start MySQL before issuing a connect command i.e.mysql -uroot -p OR mysql -uroot.

@ctlxu

This comment has been minimized.

Copy link

ctlxu commented Mar 3, 2017

I need help to solve the issue of /tmp/mysql.sock'

ctlxu$ brew services start mysql .
/Users/ap.local.lizhe.xu/Library/LaunchAgents/homebrew.mxcl.mysql.plist: Invalid property list
==> Successfully started mysql (label:
homebrew.mxcl.mysql)

ctlxu$ brew services list
Name Status User Plist
mysql started ctlxu /Users/ctlxu/Library/LaunchAgents/homebrew.mxcl.mysql.plist

ctlxu$ mysql -V .
mysql Ver 14.14 Distrib 5.7.17, for osx10.12 (x86_64) using EditLine wrapper

ctlxu$ mysqladmin -u root password 'test'
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

Thanks.

@wsakaren

This comment has been minimized.

Copy link

wsakaren commented Mar 6, 2017

+1

@arnaspecelis

This comment has been minimized.

Copy link

arnaspecelis commented Mar 9, 2017

having problems as ctlxu with " /tmp/mysql.sock" too.

@bflannery

This comment has been minimized.

Copy link

bflannery commented Mar 11, 2017

If you are having trouble with the "/tmp/mql.sock" check out this article. If you scroll down you will see the work around

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/

@lsc4719

This comment has been minimized.

Copy link

lsc4719 commented Mar 17, 2017

thanks!

@nkuhan

This comment has been minimized.

Copy link

nkuhan commented Mar 31, 2017

Thank you!

@sergiomajluf

This comment has been minimized.

Copy link

sergiomajluf commented Apr 4, 2017

Can you still install and use MySQL pref pane to start/stop the server when using brew to install MySQL?

@c4fun

This comment has been minimized.

Copy link

c4fun commented Apr 7, 2017

+1. nice and fresh. I used to use this link on stackoverflow but failed. Maybe it's too old. Yours just works!!

@shahbazi-amin

This comment has been minimized.

Copy link

shahbazi-amin commented May 4, 2017

ERROR 1045 (28000) Access denied for user 'root'@'localhost' (using password: NO)

how can i solve this on mac os Sierra ????

@iivri

This comment has been minimized.

Copy link

iivri commented Jun 2, 2017

No matter what I attempt I keep getting this error

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I followed the above instructions:

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

Enter the following command : $ brew info mysql
Expected output: mysql: stable 5.7.15 (bottled)
To install MySQL enter : $ brew install mysql

Additional configuration

Homebrew

Install brew services first : $ brew tap homebrew/services

Load and start the MySQL service : $ brew services start mysql.
Expected output : Successfully started mysql (label: homebrew.mxcl.mysql)

Check of the MySQL service has been loaded : $ brew services list 1

Verify the installed MySQL instance : $ mysql -V.
Expected output : Ver 14.14 Distrib 5.7.15, for osx10.12 (x86_64)

MySQL

Open Terminal and execute the following command to set the root password:
mysqladmin -u root password 'yourpassword'

I still get this error :

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Please help.

@simi823

This comment has been minimized.

Copy link

simi823 commented Jun 5, 2017

I'm getting the same error as @iivri -- Uninstalled and re-installed and the same issue.

@rwideman

This comment has been minimized.

Copy link

rwideman commented Jun 6, 2017

NOTE the -u and -p.....they have no spaces. This worked for me.
sudo mysql -uroot -ppassword

@singhabhyuday01

This comment has been minimized.

Copy link

singhabhyuday01 commented Jun 17, 2017

Can anyone tell me how to uninstall this if i want?

@koalaGreener

This comment has been minimized.

Copy link

koalaGreener commented Jun 21, 2017

Thank you mate, it really helps.

@eapenzhan

This comment has been minimized.

Copy link

eapenzhan commented Jul 4, 2017

@jdforsythe Please correct it to $ mysql -uroot -p for hiding the password. :)

@ssalihu

This comment has been minimized.

Copy link

ssalihu commented Jul 8, 2017

Thank you !

@wtorsi

This comment has been minimized.

Copy link

wtorsi commented Jul 9, 2017

Interesting,
I got a strange problem, my
brew services restart mysql
takes 10-20sec before i can connect to my server using
mysql -u root -p

@xiexuejun

This comment has been minimized.

Copy link

xiexuejun commented Jul 26, 2017

This is helpful!
thx!

@waiylgeek

This comment has been minimized.

Copy link

waiylgeek commented Aug 5, 2017

if you are re-installing MySQL using these instructions and you cannot log in using no password as shown on the instructions above, just try using your old MySQL password and it will work. It worked for me!

@malhal

This comment has been minimized.

Copy link

malhal commented Aug 10, 2017

Any chance you can add the instructions on how to edit the correct my.cnf before brew services start mysql cheers

@liuliangsir

This comment has been minimized.

Copy link

liuliangsir commented Aug 27, 2017

@jacqueline-homan same issue, i has spent much time in solving the issue.
however, all things seem to be in vain.
i need your help @nrollr

@rahulthakur319

This comment has been minimized.

Copy link

rahulthakur319 commented Sep 21, 2017

@iivri I have faced similar issue because I have reinstalled MySQL in my macbook. In case of reinstalling, your root password remains the same.

@harzafi

This comment has been minimized.

Copy link

harzafi commented Oct 18, 2017

thank you

@developermarshak

This comment has been minimized.

Copy link

developermarshak commented Oct 22, 2017

thanks!

@fab01

This comment has been minimized.

Copy link

fab01 commented Oct 22, 2017

why the data directory is /usr/local/var/mysql instead of /usr/local/var/mysql/data/ ?
Second: does anybody have issues with phpMyAdmin export/import procedures? Seems the process is completely stuck or terribly slow down... I have a n idea about that and it's related to the old 'famous' mysql version and Sierra conflict.
mysqld command is f**ked up as well:

InnoDB: Unable to lock ./ibdata1 error: 35
InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

@ng28

This comment has been minimized.

Copy link

ng28 commented Nov 24, 2017

Thanks!

@DylanGrahamHart

This comment has been minimized.

Copy link

DylanGrahamHart commented Nov 26, 2017

Gracias friend

@arpitsingh17

This comment has been minimized.

Copy link

arpitsingh17 commented Nov 27, 2017

https://youtu.be/isFl1SGKuKM

Hope this helps, If anyone wants to use a mysql installation file.

@anhducbkhn

This comment has been minimized.

Copy link

anhducbkhn commented Dec 8, 2017

thanks

@sayhicoelho

This comment has been minimized.

Copy link

sayhicoelho commented Dec 11, 2017

This solved my issue. Thank you!

@MrPeker

This comment has been minimized.

Copy link

MrPeker commented Dec 22, 2017

Thanks

@philalonso

This comment has been minimized.

Copy link

philalonso commented Jan 2, 2018

Thanks!

@xchen011

This comment has been minimized.

Copy link

xchen011 commented Jan 2, 2018

Xins-MacBook-Pro:~ xchen$ brew services list
Name Status User Plist
mysql started xchen /Users/xchen/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Xins-MacBook-Pro:~ xchen$ mysql -V
-bash: mysql: command not found

Can anyone help? what is the problem? Thanks!

@grbatinic-bogdan

This comment has been minimized.

Copy link

grbatinic-bogdan commented Jan 4, 2018

Thank you!

@AmroAlnajar

This comment has been minimized.

Copy link

AmroAlnajar commented Jan 12, 2018

Hello. Just one question: what's the difference between this installation and the mysql community server from dev.mysql.com?

@mobilizedesign

This comment has been minimized.

Copy link

mobilizedesign commented Jan 15, 2018

When I attempt to

brew install mysql

I receive an error message in Terminal which is as follows:

Error: No available formula with the name "mysql"
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

I've tried

brew update
brew cleanup --force
brew doctor

with no luck.

  • UPDATE *
    I uninstalled homebrew and then reinstalled it. This seems to have fixed the issue.
@aduartem

This comment has been minimized.

Copy link

aduartem commented Jan 15, 2018

thank you!

@adeorha

This comment has been minimized.

Copy link

adeorha commented Mar 3, 2018

@sergiomajluf You will need to create s symlink from /usr/local/mysql to /usr/local/Cellar/mysql*/

Hope it helps!
-Aditya

@eduardorangell

This comment has been minimized.

Copy link

eduardorangell commented Mar 13, 2018

Thank you !

@tothang

This comment has been minimized.

Copy link

tothang commented Mar 29, 2018

I got this error
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I tried so many way but I still couldn't fix it, please help

@razvansandu

This comment has been minimized.

Copy link

razvansandu commented Apr 3, 2018

@tothang, did you previously set a password? If so, try connecting with the following command: mysql -uroot -p. You will then be asked to insert the password that you previously set.

@thegrid22593

This comment has been minimized.

Copy link

thegrid22593 commented May 1, 2018

@razvansandu

That worked for me

@maxo3

This comment has been minimized.

Copy link

maxo3 commented May 2, 2018

The problem with the current mysql installation is that it does not allow startup as service under _mysql user. Everytime you log out as your user that you've installed brew under, mysql service stops. You cannot run a server environment under these conditions. I have to opt for the Community Installer instead which runs uninterrupted.

@Satori83

This comment has been minimized.

Copy link

Satori83 commented May 4, 2018

Can we download Community after Brew or we have to remove Brew version first?

@maxo3

This comment has been minimized.

Copy link

maxo3 commented May 6, 2018

you have to remove brew version . (brew uninstall mysql)

@mlevin77

This comment has been minimized.

Copy link

mlevin77 commented May 26, 2018

Ok I'm failing at step 1... On High Sierra:

bash-3.2$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/stub_specification.rb:113:in initialize': Permission denied @ rb_sysopen - /Library/Ruby/Gems/2.3.0/specifications/progressbar-1.9.0.gemspec (Errno::EACCES) from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/stub_specification.rb:113:in open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/stub_specification.rb:113:in data' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/stub_specification.rb:204:in valid?'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:749:in select' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:749:in gemspec_stubs_in'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:774:in block in map_stubs' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:771:in each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:771:in flat_map' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:771:in map_stubs'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:763:in installed_stubs' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:831:in stubs'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:1036:in find_by_path' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:189:in try_activate'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:125:in rescue in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in require'
from internal:gem_prelude:6:in `internal:gem_prelude'
bash-3.2$

any ideas?

@Jkim55

This comment has been minimized.

Copy link

Jkim55 commented Jun 7, 2018

Thanks for the concise and clear write out. Also for including the translated bit for brew services start mysql. Appreciate it!

@Dev-Jabin

This comment has been minimized.

Copy link

Dev-Jabin commented Jun 9, 2018

good job!

@mauleyzaola

This comment has been minimized.

Copy link

mauleyzaola commented Jun 19, 2018

You-are-god-period

@n3ssi3

This comment has been minimized.

Copy link

n3ssi3 commented Jul 13, 2018

I can not load mysql anymore, after brew updated mysql to version 8.0.11

~ ᐅ brew services restart mysql
Stopping `mysql`... (might take a while)
==> Successfully stopped `mysql` (label: homebrew.mxcl.mysql)
==> Successfully started `mysql` (label: homebrew.mxcl.mysql)

~ ᐅ brew services list
Name    Status  User Plist
dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
httpd   started root /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
minio   stopped
mongodb stopped
mysql   started root /Library/LaunchDaemons/homebrew.mxcl.mysql.plist
php@7.1 stopped
redis   stopped

~ ᐅ mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

~ ᐅ mysqld
2018-07-13T09:00:49.333310Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.11/bin/mysqld (mysqld 8.0.11) starting as process 26872
2018-07-13T09:00:49.337479Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2018-07-13T09:00:49.343245Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2018-07-13T09:00:49.343454Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2018-07-13T09:00:49.343476Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-07-13T09:00:49.344430Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.11/bin/mysqld: Shutdown complete (mysqld 8.0.11)  Homebrew.

Any idea how to fix this?

@deb00t

This comment has been minimized.

Copy link

deb00t commented Jul 16, 2018

just a bump. same problem as n3ssi3. will comment, if I find a solution.

@etonyali

This comment has been minimized.

Copy link

etonyali commented Jul 17, 2018

same here. Any ideas?

@operatino

This comment has been minimized.

Copy link

operatino commented Jul 17, 2018

For those who needs 5.x version from brew:

brew install mysql@5.7
brew services start mysql@5.7
brew link mysql@5.7 --force
@operatino

This comment has been minimized.

Copy link

operatino commented Jul 17, 2018

I've created a fork, updated to point to version 5.7 of MySQL https://gist.github.com/operatino/392614486ce4421063b9dece4dfe6c21

@Songkeys

This comment has been minimized.

Copy link

Songkeys commented Jul 24, 2018

@n3ssi3
same error on mac

@marioletta

This comment has been minimized.

Copy link

marioletta commented Jul 25, 2018

@n3ssi3
+1, has anyone found a solution?

I've tried every solution and my latest whoops as a last resort was running brew uninstall mysql (which uninstalled version 8 of MySQL...), does it mean I lost my databases with that move? Is it possible to recover them somehow? Many thanks.

@davidhellmann

This comment has been minimized.

Copy link

davidhellmann commented Jul 25, 2018

Same problem here. fucked me up :D

@robsalasco

This comment has been minimized.

Copy link

robsalasco commented Jul 27, 2018

same error!

@hustjiangtao

This comment has been minimized.

Copy link

hustjiangtao commented Aug 8, 2018

I recommend a better way to fix it:

(The main reason is that the older version mysql@5.7 not stopped while you upgrade mysql by homebrew, and something inside mysql data was broken. So you should reinstall older version mysql and stop the mysql services first. Then upgrade mysql data by mysql_upgrade to fix the broken data. Then you can uninstall older version or not, and latest version can be used yet.)

$ brew install mysql@5.7
$ brew services stop mysql && brew services start mysql@5.7
$ brew services stop mysql@5.7 && brew services start mysql
$ mysql_upgrade -u root -p
$ brew uninstall mysql@5.7
@Chr0213

This comment has been minimized.

Copy link

Chr0213 commented Aug 19, 2018

Thanks !

@mhsaghatforoush

This comment has been minimized.

Copy link

mhsaghatforoush commented Sep 10, 2018

hi ,
how to change this mysql localhost to other ip in local mac os ???

@rajsuvariya

This comment has been minimized.

Copy link

rajsuvariya commented Sep 25, 2018

On my mac when I try to run mysql -V then I am getting the following error.

mysql: Can't read dir of '/etc/mysql/conf.d/' (OS errno 2 - No such file or directory)
mysql: [ERROR] Fatal error in defaults handling. Program aborted!

Can anyone help me with this?

@MikeiLL

This comment has been minimized.

Copy link

MikeiLL commented Oct 9, 2018

This is what's needed from a coolestguides link above:

Fix the looming 2002 socket error – which is linking where MySQL places the socket and where macOS thinks it should be, MySQL puts it in /tmp and macOS looks for it in /var/mysql the socket is a type of file that allows mysql client/server communication.

sudo mkdir /var/mysql

Then

sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
@Mrcooder

This comment has been minimized.

Copy link

Mrcooder commented Oct 10, 2018

Use brew install mysql --client-only install mysql client only

@GesleyElois

This comment has been minimized.

Copy link

GesleyElois commented Oct 25, 2018

Thanks!

@areal060781

This comment has been minimized.

Copy link

areal060781 commented Oct 25, 2018

No matter what I attempt I keep getting this error

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I followed the above instructions:

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

Enter the following command : $ brew info mysql
Expected output: mysql: stable 5.7.15 (bottled)
To install MySQL enter : $ brew install mysql

Additional configuration

Homebrew

Install brew services first : $ brew tap homebrew/services

Load and start the MySQL service : $ brew services start mysql.
Expected output : Successfully started mysql (label: homebrew.mxcl.mysql)

Check of the MySQL service has been loaded : $ brew services list 1

Verify the installed MySQL instance : $ mysql -V.
Expected output : Ver 14.14 Distrib 5.7.15, for osx10.12 (x86_64)

MySQL

Open Terminal and execute the following command to set the root password:
mysqladmin -u root password 'yourpassword'

I still get this error :

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Please help.

mysql_upgrade -u root

@BrittleHeart

This comment has been minimized.

Copy link

BrittleHeart commented Nov 2, 2018

Thank you a lot!

@jannejava

This comment has been minimized.

Copy link

jannejava commented Nov 9, 2018

MySQL8 seems to be the default version now. Be aware that Sequel Pro seems to have some problems connecting and does not support MySQL 8. https://gist.github.com/operatino/392614486ce4421063b9dece4dfe6c21

@praveenthrilanka

This comment has been minimized.

Copy link

praveenthrilanka commented Nov 15, 2018

Thank you

@jonsoar94

This comment has been minimized.

Copy link

jonsoar94 commented Nov 22, 2018

Thank you guy, it was very helpful!!

@Pareshoct7

This comment has been minimized.

Copy link

Pareshoct7 commented Dec 6, 2018

@fabionofre Thanks for the crystal clear solution.

I applied solution from this video.

https://youtu.be/isFl1SGKuKM

Hope this helps, If anyone wants to use a mysql installation file.

but that is not enough. So, I have to follow your answer also @fabionofre

laradock/laradock#1392 (comment)

@dan-u

This comment has been minimized.

Copy link

dan-u commented Jan 24, 2019

Helpful, thanks!

@caquillo07

This comment has been minimized.

Copy link

caquillo07 commented Feb 11, 2019

None of the above worked for me, if you are still getting the socket error this worked for me:

  1. remove /usr/local/var/mysql/
  2. uninstall mysql
  3. install mysql

Seems like I had 5.7 previously installed, then uninstalled it and my fresh installation was not working properly.

@superlbr

This comment has been minimized.

Copy link

superlbr commented May 25, 2019

modify owner of mysql_upgrade_info in /usr/local/var/mysql, to solve the issue of /tmp/mysql.sock'

@rdp

This comment has been minimized.

Copy link

rdp commented Jun 23, 2019

You no longer have to install services manually via brew tap homebrew/services FWIW...

@zhouyanlt

This comment has been minimized.

Copy link

zhouyanlt commented Sep 11, 2019

Thanks!

@joshmello

This comment has been minimized.

Copy link

joshmello commented Sep 17, 2019

Thanks bro

@joeljpa

This comment has been minimized.

Copy link

joeljpa commented Oct 3, 2019

This is what's needed from a coolestguides link above:

Fix the looming 2002 socket error – which is linking where MySQL places the socket and where macOS thinks it should be, MySQL puts it in /tmp and macOS looks for it in /var/mysql the socket is a type of file that allows mysql client/server communication.

sudo mkdir /var/mysql

Then

sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

I second this. After my upgrade from High Sierra to Mojave, symlinking was the one step I had to do to fix my local LAMP projects for running. I broke my head on this for a good full day and quick searching didn't provide what I wanted. My specific case: brew handling apache2, mysql5.7 while php being the stock (php7*)...shipped with OS X. Mysql was running smoothly on its own via CLI, just that my php apps weren't handling mysql.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.