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 😎
@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

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

@julio-cavallari
Copy link

In my case, i needed to re-create log files, without the files i got the error InnoDB: File ./ib_logfile0 was not found

@musa11971
Copy link

⚠️ Warning: this solution is destructive and deletes all your current data(bases).

On macOS Sonoma 14.6. The only thing that worked for me, was to completely wipe the current installation of mariadb.

  1. cd /opt/homebrew/var
  2. rm -rf mysql
  3. brew uninstall mariadb --force
  4. brew install mariadb
  5. brew services restart mariadb
  6. brew services ->
    Screenshot 2024-08-12 at 09 21 25

@vladzadvorny
Copy link

vladzadvorny commented Aug 16, 2024

@musa11971 Thank you very much! It helped! Only mariadb started after the command:

mysql.server start

1

@sheriffmarley
Copy link

sheriffmarley commented Oct 9, 2024

Had the same issue and reinstalling didn't solved it. (M3 Pro, MacOS 14.7)

I stumbled upon this and it helped in my case:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist

@Mistralys
Copy link

Deleting the data files (ib_logfile0 and others) works, but the important question is WHY.

In my case the error occurred after upgrading MariaDB. Looking at the error log, INNODB was complaining that the logfiles had been created by a previous version:

The redo log was created with MariaDB 10.5.12. You must start up and shut down MariaDB 10.7 or earlier.

Installing the earlier version instead made it work again. I have not researched how to do the upgrade safely.

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