mysql command not found after homebrew mysql55 upgrade to 5.5 - mysql

I've been running mysql55 (5.5.30) under homebrew for a while, and yesterday I updated it to 5.5.44 using brew upgrade mysql55. Now, I am unable to log into mysql or even get it running. Important notes:
1) After running, I got the The post-install step did not complete successfully
You can try again using 'brew postinstall homebrew/versions/mysql55' and This formula is keg-only, which means it was not symlinked into /usr/local. message. Running the suggested command doesn't seem to do anything.
2) Running mysql.server start worked fine before. Now I get command not found when I try to run any mysql command. I also ran launchctl unload and then load on the plist file. I can start mysql using /usr/local/opt/mysql55/bin/mysql but I can't connect with my client using /tmp/mysql.sock (I get access denied). I tried adding /tmp/mysql.sock, but that doesn't make a difference.
3) My current data is stored in /usr/local/var/mysql (it has directories for all my current dbs), but there is a new /user/local/var/mysql55 directory with the default test, mysql, and performance_schema directories.
4) I tried modifying the mysql55.plist file to point to /usr/local/var/mysql as the data dir, and unloading and loading it again with launchctl, but I still get nothing.
5) My path has /usr/local, and the only difference I can see between now and pre-upgrade is the new data directory. The output from brew upgrade shows the command /usr/local/Cellar/mysql55/5.5.44/bin/mysql_install_db --verbose --user=steve --basedir=/usr/local/Cellar/mysql55/5.5.44 --datadir=/usr/local/var/mysql55 --tmpdir=/tmp was run. I modified it to point to the current data dir (--data-dir=/usr/local/var/mmysql), and it seemed to run ok, but I still don't get anything when I run mysql. The previous version was 5.5.30, so it seems that something is still linked to that directory.
What do I need to do just to get mysql.server to work again, using my current data directory of /usr/local/var/mysql?
Thanks.

I ran the mysql_install_db a couple times with --datadir=/usr/local/var/mysql to no effect, so I ended up just adding
basedir = /usr/local/Cellar/mysql55/5.5.44
datadir = /usr/local/var/mysql
to /etc/my.cnf, and it finds the data directory fine now.

Related

MariaDB cannot start after update: [Warning] Can't create test file /home/mysql/beta.lower-test

I've just updated MariaDB using apt-get dist-upgrade. Now it won't start using service mysql start anymore.
I can however, run it as root or do: sudo -u mysql mysqld_safe then MariaDB starts up fine. The folder /home/mysql is owned by the mysql user and group.
I've found the error to be thrown in this function:
https://github.com/MariaDB/server/blob/7ff44b1a832b005264994cbdfc52f93f69b92cdc/sql/mysqld.cc#L9865
I can't figure out what to do next. Any pointers?
To run MariaDB SQL from /home, in the file /usr/lib/systemd/system/mariadb.service or /lib/systemd/system/mariadb.service, just change :
ProtectHome=true
to :
ProtectHome=false
The answer by Thomas is correct, but get's reset by updates every few months. So here is a permanent solution:
Use systemctl edit mariadb to create a file overwritting the default settings of the mariadb service. (In debian it's located in /etc/systemd/system/mariadb.service.d/override.conf)
Set the same setting Thomas changed in the file:
[Service]
ProtectHome=false
Use systemctl daemon-reload to reload the systemctl config.
On debian 9 you need to change ProtectHome to false in both /lib/systemd/system/mariadb.service and /lib/systemd/system/mariadb#.service then run sudo systemctl daemon-reload.
Maybe also run sudo grep -Ri "protecthome" /lib/systemd/system to find other instances of ProtectHome in mysql-related files if this still isn't working
The workaround for this is mounting the directory in home as /var/lib/mysql:
mount --bind /home/mysql/var/lib/mysql /var/lib/mysql
Same situation after update on Debian 8 (Jessie) and 9 (Stretch). After "apt-get upgrade" the command
service mysql start
the server fails to start and logs error:
[Warning] Can't create test file /home/johndoe/UserDatabases/mypcname.lower-test
the solution is to change in file /lib/systemd/system/mariadb.service the value:
ProtectHome=true
to
ProtectHome=false
as described above.
#RedGiant yes I solved it. Forgot to post here.
Apparently after the .1 release you cannot run SQL from /home anymore. There's probably a way around this but haven't found it.
I can run MySQL from any location except /home. What I did was unmount /home (I had my SSD RAID mounted to /home) and re-mount my disk as /ssd. Changed my paths in the config and it worked right away.
I did not run SELinux or Apparmor.
I have faced the same issue as mentioned in the question. In my case, I wanted to move the MariaDB Data Directory to the /home/mysql folder but after changing the my.cnf file, MariaDB service was failing to start.
I have made the following changes in the file /lib/systemd/system/mariadb.service
ProtectHome=true to ProtectHome=false
It asked me to reload the daemon while starting the Mariadb service again. However, i have rebooted the server and started the MariaDB service without any issue.

Can't Start MySQL on Mavericks

I recently upgraded my Mac to Mavericks and am having trouble getting MySQL to work.
I removed my previous MySQL installation per instructions found on the web, then downloaded the DMG file and ran the installer - after which, I was able to get it running, but was not able to log in.
I noticed the installer created a /usr/local/mysql/ directory which points to /usr/local/mysql-5.6.19-osx10.7-x86_64
I then replaced the /usr/local/mysql-5.6.19-osx10.7-x86_64/data directory with the old data directory, and now I can't start MySQL.
I get the error: "warning the /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' user" and can no longer start MySQL.
I tried to change permissions of the directory with the following without luck:
sudo chmod -R 777 /usr/local/mysql/
sudo chmod -R 777 /usr/local/mysql-5.6.19-osx10.7-x86_64
sudo chown -R mysql:mysql /usr/local/mysql/data
sudo chown -R mysql:mysql /usr/local/mysql/data
sudo chown -R _mysql /usr/local/var/mysql
chown: /usr/local/var/mysql: No such file or directory
sudo chmod -R o+rwx /usr/local/var/mysql
chmod: /usr/local/var/mysql: No such file or directory
I did modify the plist file and cnf files as described here:
https://community.jboss.org/blogs/tedjones/2014/05/02/getting-mysql-up-and-running-after-upgrading-to-mavericks?_sscc=t
Not sure what else to do.
I was able to solve this problem. You just have to be meticulous when you run the install.
Please note that upgrading from Mac OS 10.8 or older to Mavericks will cause MySQL to no longer run (in other words, "Are you sure you want to upgrade to Mavericks?")
With MySQL non-functional, I decided to reinstall MySQL and upgrade to the newest version.
I followed the instructions in the link above with the following words of advice:
Backup your MySQL data directory before doing anything.
The MySQL data file is located in the /usr/local/mysql-5.6.19-osx10.7-x86_64/data directory (or similar, depending on what version you have installed).
BACK IT UP!
Make sure you stop MySQL before installing the upgraded version.
If your plist file has keepalive set to True, every time you try to quit MySQL, it will quit (or will appear to quit) but then immediately restart.
If you want to use the Preference Pane to start and stop MySQL, make sure you set keepalive in the .plist file to false, otherwise the Preference Pane won't work.
I tried to kill the plist process after making the change, but it wouldn't work. I just restarted my Mac and from that point on, I was able to start and stop MySQL from Terminal or the Preference Pane when needed.
Occasionally, the Preference Pane failed to start/stop MySQL. In that case, I would enter the start/stop command in Terminal and it worked.
Start MySQL:
sudo /usr/local/mysql/support-files/mysql.server start
Stop MySQL:
sudo /usr/local/mysql/support-files/mysql.server stop
Download the .dmg file from MySQL and run the installer.
I did try downloading the .tar file, and it may have worked - but on my second try, I chose the .dmg file and everything went smoothly.
If you try to start MySQL at this point, it should run without a problem.
Remember, since at this point you have a clean install of MySQL, you can log in with the username 'root' and password 'no password' (leave password blank).
Please note that if you start MySQL from the terminal, you will get more information than trying from the Preference Pane, so if you are having difficulty, make sure you stop and start MySQL from Terminal. You will get some error messages that you use to troubleshoot the problem.
You can modify the .cnf and .plist files as mentioned in the installer instructions above (as long as you stop MySQL before making any changes).
Typically you would copy and paste the information from the web page (mentioned above) into the .cnf file. It is pretty straight forward, but double and triple check that the copy and paste did not miss a character or two. This happened to me while pasting the code into the .cnf file (the first two characters were missing) and it took me hours to figure this out - which prevented MySQL from starting.
If the changes to the .cnf or .plist file don't seem to take effect, restart the Mac (easier than restarting the process).
Moving your data.
My install created a /usr/local/mysql/ alias or symbolic link to the /usr/local/mysql/mysql-5.6.19-osx10.7-x86_64 directory.
The /usr/local/mysql/data directory (which is actually the /usr/local/mysql/mysql-5.6.19-osx10.7-x86_64/data directory - remember, it's a symbolic link) is where your data resides.
You want a backup of your previous data directory. If you forgot to back that up before running the installer, and you have a Time Machine backup, you can retrieve it.
The easiest way to do this is to open the /usr/local/ directory (From the Finder and choose "Go to Folder" from the Go menu) and with the /usr/local/ directory open in the Finder, choose Enter Time Machine from the Time Machine menu. Go back to the last known date that has your previous MySQL installation. Find the folder of your previous MySQL install and open the data directory.
You have to choose all the files from the exact same point in time. You can't choose one data folder from one day and one data folder from another (I actually did this and spent a lot of time trying to figure out why one of my data tables were visible in Sequel Pro but wouldn't work). After a while, I finally figured out that everything absolutely has to be from the exact same point in time.
You can copy files while in Time Machine by right-clicking on them. Choose all your data folders (with the .ibd and .frm files in them) PLUS all the ib_logfiles (ib_logfile0, ib_logfile1), auto.cnf, and the .pid file. Basically copy everything in the mysql data folder EXCEPT the mysql, performance_schema, and test directories.
Exit Time Machine.
Make sure MySQL is stopped and then paste the data files into the /usr/local/mysql/data directory.
Set the privileges to the data directory.
In Terminal, enter:
sudo chown -R mysql:mysql /usr/local/mysql/data
Make sure NOT to use the chmod 777 command as some people online said it can damage things.
Now, start MySQL and you should have your data files from your previous MySQL install intact and functional. In addition, I did not have to reset any passwords for Sequel Pro. The Sequel Pro settings saved before the Mavericks upgrade worked.

ERROR! MySQL manager or server PID file could not be found! QNAP

I am having an issue where MySQL isn't starting on my QNAP NAS.
I found this first by not being able to log in through phpMyAdmin - was getting error:
#2002 Cannot log in to the MySQL server
I then went to attempt to start mysql, as I guess this is a common issue with this, but it just gave a generic error.
I went through troubleshooting the mysql.sock file and everything, changing its permissions, but nothing is working.
I have rebooted my NAS many times.
I eventually tried to restart mysql. In doing so I get:
ERROR! MySQL manager or server PID file could not be found!
I can't find anything specific to the QNAP or any general type troubleshooting for this. Everything I find seems to be OSX related.
After a lot of searching, I was able to fix the "PID file cannot be found" issue on my machine. I'm on OS X 10.9.3 and installed mysql via Homebrew.
First, I found my PID file here:
/usr/local/var/mysql/{username}.pid
Next, I located my my.cnf file here:
/usr/local/Cellar/mysql/5.6.19/my.cnf
Finally, I added this line to the bottom of my.cnf:
pid-file = /usr/local/var/mysql/{username}.pid
Hopefully this works for someone else, and saves you a headache! Don't forget to replace {username} with your machine's name (jeffs-air-2 in my case).
I tried everything above, but saw no results until I got a hint from here: https://superuser.com/questions/159486/how-to-kill-process-in-mac-os-x-and-not-have-it-restart-on-its-own
I eventually went over to the activity monitor in my Mac, force Quit the PID, and ran the command:
sudo /usr/local/mysql/support-files/mysql.server restart
The magic was done!!!
If you have installed MySQL using brew the best way to go would be with homebrew
brew services restart mysql
after you run that command, all the problems that the update generated will be resolved
I ended up figuring this out on my own.
In searching for my logs I went into
cd /usr/local/mysql/var
In there I found the file named [MyNAS].pid (replace [MyNAS] with the name of your NAS.
I then ran the following to remove the file
rm -rf /usr/local/mysql/var/[MyNAS].pid
I then restarted mysql
[/usr/local/mysql/var] # /etc/init.d/mysqld.sh restart
/mnt/ext/opt/mysql
/mnt/ext/opt/mysql
Try to shutting down MySQL
ERROR! MySQL manager or server PID file could not be found!
/mnt/ext/opt/mysql
Starting MySQL. SUCCESS!
I tested everything and it all works like a charm again!
Run the below commands and it will work.
Go to terminal and type
sudo chown -RL root:mysql /usr/local/mysql
sudo chown -RL mysql:mysql /usr/local/mysql/data
sudo /usr/local/mysql/support-files/mysql.server start
Just run mysqld (don't run as root) from your terminal. Your mysql server will restart and reset everything like shown in the picture below:
And use a command like so:
mysql -u root -h 127.0.0.1
ERROR! MySQL server PID file could not be found!
This might be due to issues with disk space, disk inode usage or innodb corruption which may lead to the error.
The issue was with the pid file and the solution was:
SSH login to server as a root
Create directory /var/run/mysql
mkdir /var/run/mysql
3) Create a file with name as mysqld.pid
touch mysqld.pid
Change its ownership and group to mysql:mysql
chown mysql:mysql mysqld.pid
Restart MySQL service
Done!
I had the same issue. It turns out I added incorrect variables to the my.cnf file. Once I removed them and restarted mysql started with no issue.
Check if your server is full first, thats a common reason (can't create the PID file because you have no space). Run this to check your disk usage..
df -h
If you get something like this, you are full..
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 40G 6.3M 100% /
In that case, you need to start looking for what to delete to make room, or add an additional drive to your server.
Nothing of this worked for me. I tried everything and nothing worked.
I just did :
brew unlink mysql && brew install mariadb
My concern was if I would lost all the data, but luckily everything was there.
Hope it works for somebody else
Note: If you just want to stop MySQL server, this might be helpful.
In my case, it kept on restarting as soon as I killed the process using PID. Also brew stop command didn't work as I installed without using homebrew. Then I went to mac system preferences and we have MySQL installed there. Just open it and stop the MySQL server and you're done. Here in the screenshot, you can find MySQL in bottom of system preferences.
I know this is an older post, but I ran into the ERROR! MySQL server PID file could not be found! when trying to start MySQL after making an update to my.cnf file. I did the following to resolve the issue:
Deleted my experimental update to my.cnf
Deleted the .net.pid and .net.err files.
delete /usr/local/var/mysql/**<YourUserName>**-MBP.airstreamcomm.net.*
Ensured all MySQL processes are stopped.
ps -ax | grep mysql
kill **<process id>**
Started MySQL server as normal.
mysql.server start
First find PID of mysql service
ps aux | grep mysql
Then, you have to kill process
sudo kill <pid>
After you again start mysql service
mysql.server start
After doing setup of PHPMyAdmin, I was also facing the same problem,
Then I just stopped the MYSQL server by going into System settings, and then started again, and it worked.
root#host [~]# service mysql restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/host.pxx.com.pid).
root#host [~]# vim /etc/my.cnf
Add Line in my.cnf its working know
innodb_file_per_table=1
innodb_force_recovery = 1
Result
root#host [~]# service mysql restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL……….. [ OK ]
root#host [~]# service mysql restart
Shutting down MySQL…. [ OK ]
Starting MySQL. [ OK ]
Source
I have the same problem. I found the file {username}.local.err instead of {username}.local.pid inside /usr/local/mysql, then i changed the name *.err to *.pid and it works fine.
Starting MySQL.
SUCCESS!
My OS El Capitan 10.11.5
If you're using MySQL Workbench, the mysql.server stop/restart/start will not work.
You will need to login into the workbench and then click "shutdown server". See image attached.
I was able to solve this on OS X by shutting down the existing mysql.server that was running:
mysql.server stop
The starting:
mysql.server start
From there I could run mysql.server restart without throwing the ERROR.

MySQL Mac OS X Problems

something strange is happening while trying to run MySQL server on my MacBook Air.
First ill installed MySQL using brew install mysql. Installation was successful without any errors.
And then problems started to showing up...
First i had to use following command in order to create empty tables:
cd /usr/local
sudo mysql_install_db --user=mysql --ldata=/var/db/mysql
Now im trying to launch the server service itself, but another error is not allowing me to do it:
ivankutsarov$ sudo mysql.server start
Password:
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Ivans-MacBook-Air.local.pid).
While ill navigate to the mentioned folder i cant see mysql folder in it, neither i can see it in my /usr/local/bin directory.
Any ideas guys?
Guys i found the problem. I forgot to run these 2 commands after installing mysql:
First, run: brew help mysql
Read the info displayed after command was executed, and you will notice in the first 2 lines the following commands which are necessary to run in order to start your server!
1.
unset TMPDIR
2.
mysql_install_db --verbose --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
I had a similar problem a day ago. mysql functioned fine until out of the blue PID file errors occur. I tried everything to fix the installation, replacing a dozen of files and trying many different settings.
what eventually worked was a clean install of mysql via the dmg package and a migration of my data&schema's to this install (use mysql workbench for this to save time), then uninstalled the version installed via brew.
https://dev.mysql.com/downloads/file/?id=466265

can't start MySql in Mac OS 10.6 Snow Leopard

I've googled this and could'nt find anything new and useful for Apple's new OS SnowLeopard.
I wonder if this is my mistake or I do need to do something?
this is what I did:
Downloaded from mysql site:
http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg
I choose : Mac OS X 10.5 (x86_64)
I run all the packages and installed all of them.
So now I certainly have mysql in
/usr/local/mysql/
But when trying to start it from preferences panel, it is always STOPPED.
When I try to do (in the terminal):
/usr/local/mysql/bin/mysql
I got :
-bash: /usr/local/mysql/bin/mysql: Bad CPU type in executable
What is wrong here?
Any help would be very appreciated. Thanks
Maybe this answer helps:
mysql5.58 unstart server in mac os 10.6.5
I just installed MySQL 5.5.8 (mysql-5.5.8-osx10.6-x86_64.dmg) on Mac os X 10.6.5 and also had the problem that MySQL was not starting.
After reading this post: http://forums.mysql.com/read.php?11,399397,399606#msg-399606
and editing the file as suggested everything started working.
I also did
sudo chown -R root:wheel /Library/StartupItems/MySQLCOM
after reading
https://discussions.apple.com/message/12820394
since when restarting my Mac OSx 10.6.6 it kept on asking something about not enough privileges. The line above solved that issue.
Now everything is working.
YOU MUST REINSTALL mySQL after upgrading to Snow Leopard and remove any previous versions as well as previous startup from the preference panel.
install 86_64 10.5...I find the others did not work for me.
Download MySQL version Mac OS X 10.5 (x86_64) located at
http://dev.mysql.com/downloads/mysql/5.4.html#macosx-dmg
Install startup Item (follow instructions)
Then install the beta version (follow instructions)
If you want the start up in the Preference Panel...install mySQL.prefpane
I find that SQL does not run from the terminal unless you start mySQL
in the preference panel.
Okay... Finally I could install it!
Why? or what I did?
well I am not sure.
first I downloaded and installed the package (I installed all the files(3) from the disk image)
but I couldn't start it. (nor from the preferences panel, nor from the termial)
second I removed it and installed through mac ports.
again, the same thing. could not start it.
Now I deleted it again, installed from the package. (i am not sure if it was the exact same package but I think it is)
Only this time I got the package from another site(its a mirror).
the site:
http://www.mmisoftware.co.uk/weblog/2009/08/29/mac-os-x-10-6-snow-leopard-and-mysql/
and the link:
http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-5.1.37-osx10.5-x86.dmg
1.- install mysql-5-1.37-osx10.5-x86.pkg
2.- install MySQLStartupItem.pkg
3.- install MySQL.prefpanel
And this time is working fine (even the preferences panel!)
Nothing special, I don't know what happened the first two times.
But thank you all.
Regards.
In order just to get MySQL working again (I haven't yet looked at startup), there is no need to reinstall . I've got my copy working by doing the following:
What you need to do is this:
sudo ln -s /usr/local/mysql-5.0.51a-osx10.5-x86_64 /usr/local/mysql
This creates a symbolic link from the /usr/local/mysql directory to the location where MySQL is. This is critical, because unless you carefully backed up all your databases with mysqldump before running the Leopard upgrade, that's where all your data lives - and restoring it simply from a whole-hard-drive backup is going to be hard.
Now you can go to the right directory and start up mysql:
cd /usr/local/mysql-5.0.51a-osx10.5-x86_64
sudo ./bin/mysqld_safe
You can now do the usual CTRL-Z to get back to the shell. To make sure mysqld is running, type:
sudo ps -A|grep mysql
I got something like this:
1220 ttys000 0:00.02 /bin/sh ./bin/mysqld_safe
1240 ttys000 0:00.39 /usr/local/mysql-5.0.51a-osx10.5-x86_64/bin/mysqld --basedir=/usr/local/mysql-5.0.51a-osx10.5-x86_64 --datadir=/usr/local/mysql-5.0.51a-osx10.5-x86_64/data --user=mysql --pid-file=/usr/local/mysql-5.0.51a-osx10.5-x86_64/data/dkmac-2.home.pid --port=3306 --socket=/tmp/mysql.soc
My copy of mysql now seems to work fine. At the very least, it's good enough to run mysqldump on all my databases, so that if I need to upgrade mysql by other means and dump my data directory, I'm still in good shape.
I'd guess that your iMac isn't 64-bit (you state in another thread it is an original white intel iMac). Try the 32-bit version of MySQL–it should install directly over the 64-bit version, I think.
How to tell if your Intel-based Mac has a 32-bit or 64-bit processor
http://support.apple.com/kb/HT3696
First of all can I just say that I really really love the Internet community for all that it does in providing answers to everybody. I don't post a lot but everybody's posting here and on so many boards helped me so much! None of them gave me the right answer mind you, but here is my unique solution to this nightmare of a spending 2 solid days trying to install MySQL 5.5.9 on Snow Leopard 10.6. Skip to bottom for resolution.
Here's what happened.
I had a server crash recently. The server was rebuilt and of course MySQL 5.5.8 didn't work. What a worthless piece. I had 5.1.54 on my other machine. That had been a pain to install as well but not like this.
I had all sorts of issues installing with the dmg from mysql.org, installing mysql5 using macports, uninstalling trying to revert to 5.1.54 (couldn't because I couldn't find the receipt file with that info even though I followed the directions). After rming everything I could find related to mysql and then reinstalling 5.5.8 everything worked! Until I rebooted... ☹ I looked in my system preference mysql pane and found mysql server wasn't starting. (skip to end for resolution)
My first error (super common) included:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock'
and numerous other EXTREMELY common issues related to mysql.sock
http://forums.mysql.com/read.php?11,9689,13272
Here were things I tried:
1)Create /etc/my.cnf file with the proper paths to mysql.sock. I even tried modifying mysql.server with vi directly. Modifying the php.ini was worthless. Nothing worked because MySQL wasn't starting, therefore it wasn't creating mysql.sock in the first place. Maybe you can point to the directory it is being created, and not the actual full file path i.e. not /tmp/mysql.sock but /tmp It was suggested but wasn't working because there was no mysql.sock because mysqld wasn't spawning.
2)Basedir and datadir modifications didn't work because there was no mysql.sock to point too.
Why? Because the mysql daemon wasn't starting. Without anything to start mysqld and thereby create mysql.sock I was doomed. They are an important part of the solution but if you try them and still get errors, you will know why.
3)sudo chown -R root:wheel /Library/StartupItems/MySQLCOM/
didn't solve my problem. I ended up having that folder and all items set to root:wheel though in the end, because it was one of the many things recommended and its working. Maybe it could remain _mysql but wheel works.
4)Copy mysql.sock from another machine. Doesn't work. I had searched and searched my new machine and couldn't find mysql.sock. I was using find / | grep mysql.sock because locate mysql wasn't finding anything. Besides I was trying so many different things it wasn't updating enough to find my new installs. I now like find much more than locate, even though you can update the locate db.
Anyhow you can't copy mysql.sock, even if you tar it because its a 0 byte file.
THE RESOLUTION: I finally stumbled onto the solution. I finally just typed mysqld from command line while I was in the proper bin directory. It said another process was running. _mysql was spawning a process that I could see in the Activity Monitor. I killed the active mysql process and when I typed mysqld again I found it was creating my mysql.sock file in the /private/tmp/mysql.sock
The mysql pref pane wouldn't start the right process on login, so I just disabled that for being worthless. It wouldn't start mysql because no mysql.sock was being created.
By then I had figured out that mysqld creates mysql.sock. I then found /opt/local/mysql/ and typed "open bin" in the terminal window. This opened the directory with mysqld in it.
I went to login items in the system preferences in my account settings and dragged and dropped the mysqld file onto the startup items there. THAT worked. Finally!
It works flawlessly because mysqld is starting up at login, which means mysql.sock is being created so no more errors about not being able to find mysql.sock.
open Terminal
cd /usr/local/mysql/support-files
sudo nano mysql.server
Find the lines:
basedir=
datadir=
change them to
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
Have you considered installing MacPorts 1.8.0 (release candidate), and keeping MySQL up-to-date that way? That will build MySQL for the architecture and OS that you're using, rather than installing a 10.5 version on 10.6.
Along with making sure you install the 64bit version, also check to make sure that the symbolic link of '/usr/local/mysql' is pointing to the correct version of your installation:
lrwxr-xr-x 1 root wheel 27B Aug 29 01:24 mysql -> mysql-5.1.37-osx10.5-x86_64
drwxr-xr-x 3 root wheel 102B Aug 29 01:25 mysql-5.1.30-osx10.5-x86
drwxr-xr-x 11 root wheel 374B Aug 29 15:59 mysql-5.1.37-osx10.5-x86_64
drwxr-xr-x 17 root wheel 578B Jul 13 22:06 mysql-5.1.37-osx10.5-x86_64.old
Alos, I found that after my installation, even though I used the pkg file from MySQL various other libraries would not build against the installation. The solution was to follow the steps to build MySQL from source found here. You can manually start it as root with the command:
/usr/loca/mysql/bin/mysqld_safe [whatever options you use]
Now ... to get the preference pane working I did the following:
Installed 64bit version of MySQL Server packet from mysql.com
Moved the package from mysql-5.1.37-osx10.5-x86_64 to mysql-5.1.37-osx10.5-x86_64.old
Did a manual compile and installation of MySQL as per these instructions
Executed the following command:
sudo cp -R /usr/local/mysql-5.1.37-osx10.5-x86_64.old/support-files /usr/local/mysql/.
Opened up the MySQL Preference Pane and tada! it works
I followed the exact same steps as answer #4....frustrating I know, but it finally worked when I installed the beta version and removed everything completely.
Removal help:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/com.mysql*
Then edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
Also go to: /Library/Receipts and look for a file named “InstallHistory.plist”. It’s just a regular property list. Open it and look for the MySQL entry, and delete it.
snow leopard is different to the "old" leopard therefore its not surprising that the sources won' work...
you should probably wait till the official release on friday and oracle might be releasing a properly working sql version soon.
Easiest Solution I've found:
After installing the MySQL package for Mac OS X Snow Leopard (check whether you have a 32bit or 64bit processor). Can always default to the 32bit version to be safe.
Simply click to install the MySQL preferences inside the dmg and when prompted whether to allow access for just you or for the entire system, choose entire system.
This worked great for me.
See this - recreating the symlink may be all you need to do: http://planet-geek.com/archives/2009/09/osx-snow-leopar.html
my apple processor version10.6.3 is error and i can click system preference
Change the following to the file
/usr/local/mysql/support-files/mysql.server the follow lines:
basedir="/usr/local/mysql"
datadir="/usr/local/mysql/data"
and save it.
In the file /etc/rc.common add the follow line at end:
/usr/local/mysql/bin/mysqld_safe --user=mysql &
I'm not entirely sure why my MySQL installation stopped working but it started trying to run as the incorrect user, as mysql instead of _mysql
Here was my error output:
140422 14:46:14 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
140422 14:46:14 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
140422 14:46:14 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
140422 14:46:14 [ERROR] Aborting
140422 14:46:14 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
The fix for me was to edit /usr/local/mysql/bin/mysqld_safe and set the user line at the top from:
user='mysql'
to
user='_mysql'
That line was on line 25 for me with mysql-5.5.37-osx10.6-x86_64
To completely uninstall on Apple Silicon (M1 or M2
) chip run bellow commands:
brew remove mysql
rm -rf /opt/homebrew/var/mysql
To install it back:
brew install mysql
mysql.server start
mysql -uroot
And can also be run using brew services
brew services start mysql