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.

Show comment
Hide comment
@marius-v

marius-v Dec 30, 2016

thank you!

marius-v commented Dec 30, 2016

thank you!

@Renrhaf

This comment has been minimized.

Show comment
Hide comment
@Renrhaf

Renrhaf commented Jan 23, 2017

thanks !

@tcelestino

This comment has been minimized.

Show comment
Hide comment
@tcelestino

tcelestino Jan 30, 2017

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

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.

Show comment
Hide comment
@jacqueline-homan

jacqueline-homan 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 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.

Show comment
Hide comment
@jacqueline-homan

jacqueline-homan Feb 6, 2017

I could really use some help here...

jacqueline-homan commented Feb 6, 2017

I could really use some help here...

@carlosfcocruz

This comment has been minimized.

Show comment
Hide comment
@carlosfcocruz

carlosfcocruz 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'

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.

Show comment
Hide comment
@jdforsythe

jdforsythe 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.

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.

Show comment
Hide comment
@puneet-ibm

puneet-ibm 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 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.

Show comment
Hide comment
@puneet-ibm

puneet-ibm 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.

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.

Show comment
Hide comment
@ctlxu

ctlxu 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.

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.

Show comment
Hide comment
@wsakaren

wsakaren commented Mar 6, 2017

+1

@arnaspecelis

This comment has been minimized.

Show comment
Hide comment
@arnaspecelis

arnaspecelis Mar 9, 2017

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

arnaspecelis commented Mar 9, 2017

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

@bflannery

This comment has been minimized.

Show comment
Hide comment
@bflannery

bflannery 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/

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.

Show comment
Hide comment
@lsc4719

lsc4719 commented Mar 17, 2017

thanks!

@nkuhan

This comment has been minimized.

Show comment
Hide comment
@nkuhan

nkuhan Mar 31, 2017

Thank you!

nkuhan commented Mar 31, 2017

Thank you!

@sergiomajluf

This comment has been minimized.

Show comment
Hide comment
@sergiomajluf

sergiomajluf Apr 4, 2017

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

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.

Show comment
Hide comment
@c4fun

c4fun 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!!

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.

Show comment
Hide comment
@shahbazi-amin

shahbazi-amin May 4, 2017

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

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

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.

Show comment
Hide comment
@iivri

iivri 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.

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.

Show comment
Hide comment
@simi823

simi823 Jun 5, 2017

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

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.

Show comment
Hide comment
@rwideman

rwideman Jun 6, 2017

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

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.

Show comment
Hide comment
@singhabhyuday01

singhabhyuday01 Jun 17, 2017

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

singhabhyuday01 commented Jun 17, 2017

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

@koalaGreener

This comment has been minimized.

Show comment
Hide comment
@koalaGreener

koalaGreener Jun 21, 2017

Thank you mate, it really helps.

koalaGreener commented Jun 21, 2017

Thank you mate, it really helps.

@eapenzhan

This comment has been minimized.

Show comment
Hide comment
@eapenzhan

eapenzhan Jul 4, 2017

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

eapenzhan commented Jul 4, 2017

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

@ssalihu

This comment has been minimized.

Show comment
Hide comment
@ssalihu

ssalihu Jul 8, 2017

Thank you !

ssalihu commented Jul 8, 2017

Thank you !

@wtorsi

This comment has been minimized.

Show comment
Hide comment
@wtorsi

wtorsi 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

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.

Show comment
Hide comment
@xiexuejun

xiexuejun Jul 26, 2017

This is helpful!
thx!

xiexuejun commented Jul 26, 2017

This is helpful!
thx!

@waiylgeek

This comment has been minimized.

Show comment
Hide comment
@waiylgeek

waiylgeek 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!

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.

Show comment
Hide comment
@malhal

malhal Aug 10, 2017

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

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.

Show comment
Hide comment
@liuliangsir

liuliangsir 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

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.

Show comment
Hide comment
@rahulthakur319

rahulthakur319 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.

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.

Show comment
Hide comment
@harzafi

harzafi Oct 18, 2017

thank you

harzafi commented Oct 18, 2017

thank you

@developermarshak

This comment has been minimized.

Show comment
Hide comment
@developermarshak

developermarshak commented Oct 22, 2017

thanks!

@fab01

This comment has been minimized.

Show comment
Hide comment
@fab01

fab01 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.

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.

Show comment
Hide comment
@ng28

ng28 Nov 24, 2017

Thanks!

ng28 commented Nov 24, 2017

Thanks!

@DylanGrahamHart

This comment has been minimized.

Show comment
Hide comment
@DylanGrahamHart

DylanGrahamHart Nov 26, 2017

Gracias friend

DylanGrahamHart commented Nov 26, 2017

Gracias friend

@arpitsingh17

This comment has been minimized.

Show comment
Hide comment
@arpitsingh17

arpitsingh17 Nov 27, 2017

https://youtu.be/isFl1SGKuKM

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

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.

Show comment
Hide comment
@anhducbkhn

anhducbkhn commented Dec 8, 2017

thanks

@sayhicoelho

This comment has been minimized.

Show comment
Hide comment
@sayhicoelho

sayhicoelho Dec 11, 2017

This solved my issue. Thank you!

sayhicoelho commented Dec 11, 2017

This solved my issue. Thank you!

@MrPeker

This comment has been minimized.

Show comment
Hide comment
@MrPeker

MrPeker commented Dec 22, 2017

Thanks

@philalonso

This comment has been minimized.

Show comment
Hide comment
@philalonso

philalonso commented Jan 2, 2018

Thanks!

@xchen011

This comment has been minimized.

Show comment
Hide comment
@xchen011

xchen011 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!

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.

Show comment
Hide comment
@grbatinic-bogdan

grbatinic-bogdan commented Jan 4, 2018

Thank you!

@AlnajarApps

This comment has been minimized.

Show comment
Hide comment
@AlnajarApps

AlnajarApps Jan 12, 2018

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

AlnajarApps 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.

Show comment
Hide comment
@mobilizedesign

mobilizedesign 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.

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.

Show comment
Hide comment
@aduartem

aduartem Jan 15, 2018

thank you!

aduartem commented Jan 15, 2018

thank you!

@adeorha

This comment has been minimized.

Show comment
Hide comment
@adeorha

adeorha Mar 3, 2018

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

Hope it helps!
-Aditya

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.

Show comment
Hide comment
@eduardorangell

eduardorangell commented Mar 13, 2018

Thank you !

@tothang

This comment has been minimized.

Show comment
Hide comment
@tothang

tothang 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

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.

Show comment
Hide comment
@razvansandu

razvansandu 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.

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.

Show comment
Hide comment
@thegrid22593

thegrid22593 commented May 1, 2018

@razvansandu

That worked for me

@maxo3

This comment has been minimized.

Show comment
Hide comment
@maxo3

maxo3 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.

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.

Show comment
Hide comment
@Satori83

Satori83 May 4, 2018

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

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.

Show comment
Hide comment
@maxo3

maxo3 May 6, 2018

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

maxo3 commented May 6, 2018

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

@mlevin77

This comment has been minimized.

Show comment
Hide comment
@mlevin77

mlevin77 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:inopen'
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:invalid?'
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:ingemspec_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:ineach'
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:inmap_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:instubs'
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:intry_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:inrequire'
from internal:gem_prelude:6:in `internal:gem_prelude'
bash-3.2$

any ideas?

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:inopen'
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:invalid?'
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:ingemspec_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:ineach'
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:inmap_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:instubs'
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:intry_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:inrequire'
from internal:gem_prelude:6:in `internal:gem_prelude'
bash-3.2$

any ideas?

@Jkim55

This comment has been minimized.

Show comment
Hide comment
@Jkim55

Jkim55 Jun 7, 2018

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

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.

Show comment
Hide comment
@Dev-Jabin

Dev-Jabin commented Jun 9, 2018

good job!

@mauleyzaola

This comment has been minimized.

Show comment
Hide comment
@mauleyzaola

mauleyzaola Jun 19, 2018

You-are-god-period

mauleyzaola commented Jun 19, 2018

You-are-god-period

@n3ssi3

This comment has been minimized.

Show comment
Hide comment
@n3ssi3

n3ssi3 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?

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.

Show comment
Hide comment
@deb00t

deb00t Jul 16, 2018

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

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.

Show comment
Hide comment
@etonyali

etonyali Jul 17, 2018

same here. Any ideas?

etonyali commented Jul 17, 2018

same here. Any ideas?

@operatino

This comment has been minimized.

Show comment
Hide comment
@operatino

operatino 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 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.

Show comment
Hide comment
@operatino

operatino Jul 17, 2018

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

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.

Show comment
Hide comment
@Songkeys

Songkeys Jul 24, 2018

@n3ssi3
same error on mac

Songkeys commented Jul 24, 2018

@n3ssi3
same error on mac

@marioletta

This comment has been minimized.

Show comment
Hide comment
@marioletta

marioletta 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.

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.

Show comment
Hide comment
@davidhellmann

davidhellmann Jul 25, 2018

Same problem here. fucked me up :D

davidhellmann commented Jul 25, 2018

Same problem here. fucked me up :D

@robsalasco

This comment has been minimized.

Show comment
Hide comment
@robsalasco

robsalasco Jul 27, 2018

same error!

robsalasco commented Jul 27, 2018

same error!

@hustjiangtao

This comment has been minimized.

Show comment
Hide comment
@hustjiangtao

hustjiangtao 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

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.

Show comment
Hide comment
@Chr0213

Chr0213 commented Aug 19, 2018

Thanks !

@mhsaghatforoush

This comment has been minimized.

Show comment
Hide comment
@mhsaghatforoush

mhsaghatforoush Sep 10, 2018

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

mhsaghatforoush commented Sep 10, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment