Mysqld_safe not starting mysql5?
// June 4th, 2010 // No Comments » // Tips and Tricks, development
So I use macports to install mysql5 and when I was ready to start mysql using mysqld_safe, which is located:
/opt/local/bin/
I ended getting a big error report which said something along the lines of:
mkdir: /opt/local/var/run: No such file or directory chown: /opt/local/var/run/mysql5: No such file or directory chmod: /opt/local/var/run/mysql5: No such file or directory
Solution
I solved this by doing the following:
- Make sure you have ran the following command after the install completes:
sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
- Finally you have to do the following:
sudo mkdir /opt/local/var/run sudo chmod g+w /opt/local/var/run/ sudo mkdir /opt/local/var/run/mysql5 sudo chown mysql /opt/local/var/run/mysql5/
Now you should be able to start mysql with no problems! A little bonus is create alias for starting and stopping mysql. My MBP is running Snow Leopard so I edit:
~/.profile
and add the following at the end of the file:
alias mysqlstart='sudo /opt/local/bin/mysqld_safe5 &' alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'



