-4

I was running mamp on el capitan 10.11.3. I decided to update mysql to version 5.7.11, so I ran this:

tar xfvz mysql-5.7*

echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld

echo "creating backup"
sudo rsync -a /Applications/MAMP ~/Desktop/MAMP-Backup

echo "copy bin"
sudo rsync -av mysql-5.7.*/bin/* /Applications/MAMP/Library/bin/ --exclude=mysqld_multi --exclude=mysqld_safe

echo "copy share"
sudo rsync -av mysql-5.7.*/share/* /Applications/MAMP/Library/share/

echo "fixing access (workaround)"
sudo chmod -R o+rw  /Applications/MAMP/db/mysql/
sudo chmod -R o+rw  /Applications/MAMP/tmp/mysql/

echo "starting mamp"
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
sudo /Applications/MAMP/bin/start.sh

echo "migrate to new version"
sudo chmod -R 777 /Applications/MAMP/db/mysql/
/Applications/MAMP/Library/bin/mysql_upgrade --user=root --password=root --host=localhost --port=3306

this is a script i found online. The tarball that I used was: mysql-5.7.11-osx10.10-x86_64.tar

now, I am unable to start mamp from the app, and when I run mysql in command line, I get :

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

harveyslash
  • 129
  • 2
  • 10
  • I am constantly getting down voted, and yet I am not able to delete the question. – harveyslash Mar 16 '16 at 03:29
  • 1
    Once a question has been answered, it can't be deleted anymore by the author. If you still want to have it deleted, you can flag it it for moderator attention, but no definite guarantees there, either.- In general though questions *"I followed such and such script/tutorial/howto and it doesn't work"* are not well received because SF expects professionals to try and understand what they are doing and come up with more specific questions after investigating any issues... – HBruijn Apr 02 '16 at 12:22

1 Answers1

1

I solved it by installing mysql-server, so make sure that you have installed the mysql-server, not the mysql-client or something else.

That error means the file

/var/run/mysqld/mysqld.sock

doesn't exists, if you didn't install mysql-server, then the file would not exist. But if the mysql-server is already installed and is running, then you need to check the config files.

The config files are:

 /etc/my.cnf
 /etc/mysql/my.cnf
 /var/lib/mysql/my.cnf

In

/etc/my.cnf 

the socket file config may be

/tmp/mysql.sock

and in

/etc/mysql/my.cnf 

the socket file config may be

/var/run/mysqld/mysqld.sock 

So, remove or rename /etc/mysql/my.cnf, let mysql use /etc/my.cnf, then the problem may solved.

imvikasmunjal
  • 695
  • 7
  • 14