Skip to content

Instantly share code, notes, and snippets.

@irazasyed
Created October 7, 2020 00:05
Show Gist options
  • Save irazasyed/a74766108b4630fc5c7c822df23526e8 to your computer and use it in GitHub Desktop.
Save irazasyed/a74766108b4630fc5c7c822df23526e8 to your computer and use it in GitHub Desktop.
Solution for MySQL / MariaDB Start Issue on MacOS

Solution for MySQL / MariaDB Start Issue on MacOS

Errors

On trying to start mysql.server start

./usr/local/bin/mysql.server: line 264: kill: (12262) - No such process ERROR!

On trying to connect mysql -uroot

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

Solution

  • Stop MySQL / MariaDB.
  • Go to /usr/local/var/mysql
  • Delete ib_logfile0 & ib_logfile1 files.
  • Try to start now, It should work 😎
@ayyappa7
Copy link

Great! it works, removing log files from the MySQL server path /opt/homebrew/var/mysql/ made it work for me.

@lscosta7
Copy link

Obrigado pela ajuda, consegui resolver.

@glwinsor
Copy link

Thank you!

@fatkhurohman93
Copy link

many thanks!

@noeurphireak
Copy link

Thank you Sir

@paul-rudnicki
Copy link

Thank, You saved my time.

@cutterkom
Copy link

Had to delete ibdata1 as well

@cmartin6
Copy link

Had to delete ibdata1 as well

Do your existing databases still work? Mine are corrupt now...

@Herz3h
Copy link

Herz3h commented Jul 27, 2022

ty very much !!

@agabone
Copy link

agabone commented Aug 1, 2022

Thank you sir!!!!!!!!!

@unclecheese
Copy link

Thank you!

Had to delete ibdata1 as well

👆 Monterey M1 Pro -- didn't work until I did this as well.

@vinayaksh42
Copy link

I have been struggling with this issue from hours and this solution helped me.
Thanks a lot!

@udit-pi
Copy link

udit-pi commented Sep 29, 2022

Thank you!

Had to delete ibdata1 as well

👆 Monterey M1 Pro -- didn't work until I did this as well.

DON'T DELETE ibdata1 if you want to keep your old databases. Ibdata has information about all your databases.
If you have done it already like me, then use TimeMachine to recover your old ibdata1 file.

@iLynette
Copy link

That worked for me too, thank you.

@Nidar53
Copy link

Nidar53 commented Nov 11, 2022

perfect, thank you.

@ramofarouk
Copy link

It works, thanks you sir!

@RahmanAshiq
Copy link

In my macOS High Sierra (10.13.6) deleting the "tc.log" file from "/usr/local/var/mysql" did the job.

@l-o-u-k-e
Copy link

It worked for me too. Thanks!

@paujur
Copy link

paujur commented Dec 4, 2022

Thanks!

@saurabhghatnekar
Copy link

I'm using Mac M1, macOS 13.0.1
for me the logfile was in /Users//data/mariadb folder

@ingageco
Copy link

ingageco commented Dec 23, 2022

Had to delete ibdata1 as well

This worked for me as well. Just move it to the desktop, restart mariadb, then put it back. Seems to get the job done!

@rizkyhello
Copy link

Thank's solution not running mysl database mac

@jcouturier
Copy link

jcouturier commented Feb 11, 2023

None of the suggested solutions worked because I installed mariadb with homebrew. So, using brew services to start/stop actually works. brew services start mariadb
See here for more details.

@abhinav7sinha
Copy link

/opt/homebrew/etc/my.cnf

Thanks, after spending a whole day - finally found it here - /opt/homebrew/var/mysql

@adel-ezz
Copy link

thanks a lot, you save my day

@arwinvdv
Copy link

After updating to macOS Sonoma 14 the connection with 127.0.0.1 was not working anymore (localhost was working correct).

I added this:

[mysqld]
bind-address = 127.0.0.1
skip-name-resolve = 1

at the bottom of /opt/homebrew/etc/my.cnf and ran the command brew services restart mariadb to fix it.

@Tensae-abita
Copy link

Thank you!! You are a lifesaver. this worked for me

@Darmolar
Copy link

/Applications/XAMPP/xamppfiles/var/mysql

Thank you. not been able to do anything for 3days

@DiegoMartinUY
Copy link

Excelent!! That fixed the problem for me. Thanks

@mohamedElshamy00000
Copy link

⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐

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