Related
Recently I installed MySQL Workbench 6.2 and used it to create ER diagrams of the MySQL 5.5.41 databases I'm working with on Ubuntu 12.04. Everything worked fine until I restarted Ubuntu and suddenly mysql was no longer running. Running mysqld from the command line results in this:
150216 12:50:37 [ERROR] Can't read from messagefile '/usr/share/mysql/english/errmsg.sys'
150216 12:50:37 [Warning] Can't create test file /var/lib/mysql/euler.lower-test
150216 12:50:37 [Warning] Can't create test file /var/lib/mysql/euler.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
150216 12:50:37 [ERROR] Aborting
150216 12:50:37 [Note]
The file /usr/share/mysql/english/errmsg.sys exists, owned by root, with permissions 644. The directory /var/lib/mysql exists, owned by mysql, with permissions 700.
I'm guessing that the installation of Workbench changed something (maybe config files) so that mysql is no longer working, but after a fair amount of Internet research, I have not discovered how to solve this problem. Any help will be greatly appreciated.
Seems like file permission problem. Try running mysqld again using sudo
If this doesn't help, maybe you shouldn't be starting it directly via mysqld. Check if the installer package added a service
sudo service --status-all | grep mysql
And if one exist, use it to start mysql, typically:
sudo service mysqld start
Also don't forget to check if mysqld is already running. If so you can't start duplicate process. I know this sound silly but has happened to me before
ps -ef | grep mysqld
My MAMP mysql server won't start. All of the suggestions I've seen on the web say to check for other mysqld processes running and kill them if they exist, and that it should fix the problem, but it has not for me.
Here's the error log:
130415 13:42:12 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
130415 13:42:12 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
130415 13:42:12 [Note] Plugin 'FEDERATED' is disabled.
130415 13:42:12 InnoDB: The InnoDB memory heap is disabled
130415 13:42:12 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130415 13:42:12 InnoDB: Compressed tables use zlib 1.2.3
130415 13:42:12 InnoDB: Initializing buffer pool, size = 128.0M
130415 13:42:12 InnoDB: Completed initialization of buffer pool
130415 13:42:12 InnoDB: highest supported file format is Barracuda.
130415 13:42:13 InnoDB: Waiting for the background threads to start
130415 13:42:14 InnoDB: 1.1.8 started; log sequence number 1707549
130415 13:42:14 [Note] Event Scheduler: Loaded 0 events
130415 13:42:14 [Note] /Applications/MAMP/Library/bin/mysqld: ready for connections.
Version: '5.5.25' socket: '/Applications/MAMP/tmp/mysql/mysql.sock' port: 0 Source distribution
It looks like the connection is open to me, but MAMP stil errors out with this message: "MySQL wasn't able to start. Please check log for more information."
Any suggestions?
What worked for me was removing all files (but not directories) in the mysql dir.
Edit #2 As per answers below, you only need to delete the log files: [ib_logfile0, ib_logfile1]
So quit MAMP and then in the terminal:
rm /Applications/MAMP/db/mysql/ib_logfile* #(or wherever your MAMP is installed)
Edit!: A few people have mentioned that you may want to back up these files first in case anything goes wrong, so maybe just use mv instead:
mv /Applications/MAMP/db/mysql/* /tmp/.
If this doesn't work go back and kill all processes:
sudo killall -9 mysqld
This is also duplicated here:
mysql server won't start MAMP
The easiest solution: quit MAMP and remove the log files from MAMP/db/mysql directory [ib_logfile0, ib_logfile1] and restart MAMP.
For more visit http://juanfra.me/2013/01/mysql-not-starting-mamp-fix/
Since none of the answers here solved my particular issue, I should probably add my own solution to to the list.
I had to hard reset my computer while MAMP was still running. This sometimes leads to a problem where, after restarting the machine, MAMP can start the Apache Server, but can not start the MySQL server for some reason.
My solution for this issue was to:
Close MAMP
Go to Applications/MAMP/tmp/mysql
delete the file mysql.sock.lock
Restart MAMP
rm /Applications/MAMP/db/mysql56/*
Works fine, but then it shows "No database found" in phpmyadmin although there are databases, so my drupal gave me errors because of this.
All I need to do is simply remove two files ib_logfile0 and ib_logfile1 from /Applications/MAMP/db/mysql56/ and that did the trick for me.
I looked at the MAMP site. Go into MAMP/db/mysql56 and rename both the log files (I just changed the number at the end). Voila, restarted MAMP and all was well.
Log File names:
ib_logfile0
ib_logfile1
Stop MAMP server.
Then go in following folder:
Applications/MAMP/db/mysql56/
In this folder, please remove all direct files except folders.
This means that you have to remove only auto.cnf, ibdata, ib_logfile, not any folders.
Restart MAMP server.
It should work.
Thank you.
Most of the answers here are offering to delete random files.
Most of the time, this is the worst thing to do especially if it is important for you to keep the integrity of your development environment.
As explained in the log file, if this problem is not related to a read access permission nor to a file you deleted in your mysql then the only solution is to:
Open your my.conf file from the File menu in MAMP (File > Edit Template > MySQL)
Find and edit this line to be: innodb_force_recovery = 1
Save with ctrl+S
MAMP will offer you to restart your servers
Go back building the next unicorn :)
Just type below command in terminal:
rm /Applications/MAMP/db/mysql56/ib_logfile*
and then restart the MAMP.
It works back perfectly.
I had to do a combination of things. First I had to change the permissions on my mysql directory. applications/MAMP/db/mysql56/mysql see Stackoverflow here
If that doesn't work add in a my.cnf file to applications/MAMP/conf folder with the following
[mysqld]
innodb_force_recovery = 1
see Adel 'Sean' Helal . answer
This is what ended up working for me.
Im posting this as a potensial Answer!
What i did to solve this was the following:
Restart the computer ( to make sure no mysqld processes are running, even if it crashed and tries to restart itself)
Delete everything that has anything to do with mysql on the computer by running these commands:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/MySQL*
vim /etc/hostconfig and removed the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/MySQL*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
Delete MAMP by running the MAMP PRO uninstaller, then deleting the applications/MAMP folder
Delete the Library/Application Support/appsolute folder (MAMP application support folder)
Reinstall MAMP PRO
Hopefully this helps :)
I just had this problem. These are the steps that worked for me.
Open Preferences in MAMP, make a note of your current Apache and MySQL Port numbers.
Click both Set to default Apache and MySQL ports and Reset MAMP buttons then OK.
Quit MAMP
Delete all files (not folders) from /Applications/MAMP/db/mysql directory.
Reboot MAMP and click Start Servers.
Note: if MySQL starts fine but Apache doesn't, go back to Preferences and set Apache Port back to what it was before. MAMP should refresh after you click OK and both Apache and MySQL should start.
If http://localhost/MAMP/index.php fails to load, open Developer Tools (Chrome), right-click on refresh button and select Empty Cache and Hard Reload. The phpAdmin page should load. If not try going to Application panel in Developer tools, select Clear Storage from the menu and click Clear Site Data.
I hope those steps provide a quick fix for someone without needed to destroy your database tables.
I’ve seen on different answers that we have to remove ib_logfile0 and ib_logfile1 in Applications/MAMP/db/mysql56/
If you use MAMP PRO 4, these files are in /Library/Application Support/appsolute/MAMP PRO/db/mysql56/
Removing theses fils works for me (the serveur doesn’t start after a system crash).
Ok, so I tried EVERY suggestion i found here on SO and other forums I nothing worked for me. The only solution, that worked for me was to install MAMP 3 version, since I use MAMP for wordpress projects version 3 works just fine.
Remove the files ib_logfileN (N being the number) from the MAMP/db/mysql56 folder.
Then restart MAMP.
Should Work!
I've tried all the solutions above with version 4.2 of MAMP and none of them worked to me in El Capitan OS, so the only thing that worked was uninstalled MAMP with Clean My Mac and then install the older 3.5.2 version, that one worked right away.
MAMP & MAMP PRO 4.0.6 was starting MySql server correctly but stopped doing so after my machine updated the OS to macOS Sierra (10.12.2). I tried a few options mentioned here including setting folder permissions and re-install etc. Nothing seemed fixed the issue for me so I shifted to XAMPP and it is serving OK so far.
Update: I've got MAMP working with this simple solution here.
Best way to find the real cause is to check the MAMP error log in MAMP > logs > mysql_error_log.err
I found the ERROR "Do you already have another mysql server running on port: 3306 ?" - which was actually the cause for my MAMP MYSQL not starting.
Port 3306 was already "busy", so I have changed it to 8306 and that solved my issue.
I was running MAMP 4.1 on windows and MYSQL 5.7 .Was having this problem many times and found out a fix for this:
For me deleting the log files was not working then just delete
mysql-bin.index
YOUR_PC_NAME.pid
and boom it starts working again.
If this also doesn't work for your, remember to delete each file one by one and keep checking if any works for you.
Make sure to backup always.
I just ran this in terminal: sudo killall -9 mysqld and then I force quit MAMP.
Reopen Mamp and everything works perfectly.
Sometimes, just turning off and restarting your computer does the trick.
None of the above answers worked for me (I did MAMP upgrade to latest 5.7 on MacOS).
After a while of digging through the error log (/Applications/MAMP/logs/mysql_error_log.err) i found out that there's an error [ERROR] unknown variable 'thread_concurrency=8'] that causes termination.
Based on a post about upgrades i removed the directive from my.cnf and restarted MAMP. All worked well afterwards (was prompted to upgrade DBs, etc.)
Here's what worked for me:
Check to see if you accidentally installed mysql via Brew or something. brew list mysql
Uninstall it brew uninstall mysql
Try to fire up MAMP. Might need to reinstall.
Eventually upgrade to Vagrant and stop fighting with MAMP.
What worked for me was:
I had a process called "mysqld" running even when MAMP had been quit. I force quit the process, restarted MAMP and it worked again.
In case of MAMP PRO you need to remove ib_logfiles here:
rm -rf /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile*
For me the line innodb_additional_mem_pool_size in my.cnf was causing it
If you are using MAMP PRO 5.7+ (18029)
1.Just stop MAMPRO.
2.Goto to directory /Applications/MAMP/db/mysql##
(Where ## is the Number of your Mysql version)
3.List the files with command: ls -l *
4. Type command:
rm ib_logfile* #Just must delete theses 2 files.
5.Restart MAMPRO and its must works fine!
Caution: If you remove the files ibdata1 will destroy all you "databases"
This is what worked for me (Windows 10) :
Click on Start Servers in MAMP
Manually click on mysql.exe in MAMP installation folder
(C:\MAMP\bin\mysql\bin\mysql.exe)
Tip : You can pin mysql.exe to Start Menu so you don't always have to search for this folder
I have mac system and my mamp does not start properly.
Just restart my system and then start mamp again then it's working properly
You need to leave the mysql database AS IS.
Uninstall and reinstall MAMP Pro.
For every WP instance that you want to have on your server (localhost), you need to create a NEW database that is not mysql.
Go into SequelPro and add database.
Use Duplicator to transfer your WP.
Do not use mysql for anything, it appears to be required by MAMP.
I am on a server that has afresh install on RHEL 5. I was able to install Apache and PHP just fine., but I am having serious trouble with my MySQL installation. I tried the following:
yum install mysql-server mysql
And didn't get any errors or conflicts. Then I tried to start mysql with the following commands:
chkconfig --levels 235 mysqld on
service mysqld start
And get Timeout error occurred trying to start MySQL Daemon.
I checked my logs and see this error:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
I'm not sure where to go from here.
For reference I am using RHEL 5 and installed the latest versions of PHP 5 and Apache.
After chown and chgrp'ing /var/lib/mysql per the answer by #Bad Programmer, you may also have to execute the following command:
sudo mysql_install_db --user=mysql --ldata=/var/lib/mysql
Then restart your mysqld.
Uninstall mysql using yum remove mysql*
Recursively delete /usr/bin/mysql and /var/lib/mysql
Delete the file /etc/my.cnf.rmp
Use ps -e to check the processes to make sure mysql isn't still running.
Reboot server with reboot
Run yum install mysql-server. This also seems to install the mysql client as a dependency.
Give mysql ownership and group priveleges with:
chown -R mysql /var/lib/mysql
chgrp -R mysql /var/lib/mysql
Use service mysqld start to start MySQL Daemon.
I had this issue on arch linux as well. The issue was pacman installed the package in a different location than MySQL was expecting. I was able to fix the issue with this:
sudo mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/
Hope this helps someone!
The root of my problem seemed to be selinux, which was turned on (enforcing)
automatically on OS install.
I wanted my mysql in /data.
After verifying that my.cnf had:
datadir=/data/mysql
(and leaving the socket at /var/lib/mysql)
I executed the command to turn off selinux for mysqld
(alternative is to turn it off completely):
setsebool -P mysqld_disable_trans=1
I ran the following commands:
> chown -R mysql .
> chgrp -R mysql .
> mysql_install_db --user=mysql
I started the mysql daemon and everything worked fine after that.
mysql_install_db –-user=mysql --ldata=/var/lib/mysql
Worked for me in Centos 7
initialize mysql before start on windows.
mysqld --initialize
When download mysql zip version, if run mysqld directly, you'll get this error:
2016-02-18T07:23:48.318481Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2016-02-18T07:23:48.319482Z 0 [ERROR] Aborting
You have to run below command first:
mysqld --initialize
Make sure your data folder is empty before this command.
Just this command is enough to do the magic on centos 6.6
mysql_install_db
I just met the same problem with mysql 5.7 on OSX:
rm -rf {datadir}
mysqld --initialize --datadir {datadir}
mysqld --datadir {datadir}
If you move your datadir, you not only need to give the new datadir permissions, but you need to ensure all parent directories have permission.
I moved my datadir to a hard drive, mounted in Ubuntu as:
/media/*user*/Data/
and my datadir was Databases.
I had to set permissions to 771 to each of the media, user and Data directories:
sudo chmod 771 *DIR*
If this does not work, another way you can get mysql to work is to change user in /etc/mysql/my.cnf to root; though there are no doubt some issues with doing that from a security perspective.
For myself, I had to do:
yum remove mysql*
rm -rf /var/lib/mysql/
cp /etc/my.cnf ~/my.cnf.bkup
yum install -y mysql-server mysql-client
mysql_install_db
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:mysql /var/log/mysql
service mysql start
Then I was able to get back into my databases and configure them again after I nuked them the first go around.
In my case the path of MySQL data folder had a special character "ç" and it make me get...
Fatal error: Can't open and lock privilege tables: Table 'mysql.host'
doesn't exist.
I'm have removed all special characters and everything works.
On CentOS EL 6 and perhaps on earlier versions there is one way to get into this same mess.
Install CentOS EL6 with a minimal installation. For example I used kickstart to install the following:
%packages
#core
acpid
bison
cmake
dhcp-common
flex
gcc
gcc-c++
git
libaio-devel
make
man
ncurses-devel
perl
ntp
ntpdate
pciutils
tar
tcpdump
wget
%end
You will find that one of the dependencies of the above list is mysql-libs. I found that my system has a default my.cnf in /etc and this contains:
[mysqld]
dataddir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
When you build from the Generic Linux (Architecture Independent), Compressed TAR Archive your default data directory is /usr/local/mysql/data which conflicts with the /etc/my.cnf already present which defines datadir=/var/lib/mysql. Also the pid-file defined in the same file does not have permissions for the mysql user/group to write to it in /var/run/mysqld.
A quick remedy is to mv /etc/my.cnf /etc/my.cnf.old which should get your generic source procedure working.
Of course the experience is different of you use the source RPMs.
I had the same issue in trying to start the server and followed the "checked" solution.
But still had the problem. The issue was the my /etc/my.cnf file was not pointing to my
designated datadir as defined when I executed the mysql_install_db with --datadir defined. Once I updated this, the server started correctly.
If you have a server which used to happily run MySQL, but now gives this error, then an uninstall and re-install of MySQL is overkill.
In my case, the server died and took a few disk blocks with it. This affected a few files, including /var/lib/mysql/mysql/host.frm and /var/lib/mysql/mysql/proc.frm
Luckily, I could copy these from another server, and this got me past that table error.
I got similar error on overlayfs (overlay2) that is the default on Docker for Mac.
The error happens when starting mysql on the image, after creating a image with mysql.
2017-11-15T06:44:22.141481Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table storage engine for 'user' doesn't have this option
Switching to "aufs" solved the issue.
(On Docker for Mac, the "daemon.json" can be edited by choosing "Preferences..." menu, and selecting "Daemon" tab, and selecting "Advanced" tab.)
/etc/docker/daemon.json :
{
"storage-driver" : "aufs",
"debug" : true,
"experimental" : true
}
Ref:
https://github.com/moby/moby/issues/35503
https://qiita.com/Hige-Moja/items/7b1208f16997e2aa9028
In Windows run the following commands in the command prompt as adminstrator
Step 1:
mysql_install_db.exe
Step 2:
mysqld --initialize
Step 3:
mysqld --console
Step 4:
In windows
Step 4:
mysqladmin -u root password "XXXXXXX"
Step 5:
mysql -u root -p
My case on Ubuntu 14.04.2 LTS was similar to others with my.cnf, but for me the cause was a ~/.my.cnf that was leftover from a previous installation. After deleting that file and purging/re-installing mysql-server, it worked fine.
I installed MySQL on a Mac after downloading its DMG file version 64 bit.
While trying to create a database it gave me error 1006 -- can't create database. After browsing a number of website, it seems due to user ownership setting of MySQL "data directory" location that needs to be changed.
Where is MySQL default data directory? I could not find /var/lib/mysql in localhost.
THANKS.
If the software is Sequel pro the default install mysql on Mac OSX has data located here:
/usr/local/var/mysql
See if you have a file located under /etc/my.cnf. If so, it should tell you where the data directory is.
For example:
[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
...
My guess is that your mysql might be installed to /usr/local/mysql-XXX.
You may find these MySQL reference manual links useful:
Installing MySQL 8.0 on MacOS
Installing MySQL 5.7 on MacOS
Installing MySQL 5.6 on MacOS
Installing MySQL 5.5 on MacOS
As suggested, I edited this message to place a proper answer.
The 'physical' location of the MySQL database is under /usr/local/mysql
The mysql is a symlink to the current active MySQL installation, in my case the exact folder is mysql-5.6.10-osx10.7-x86_64.
Inside that folder you'll see another data folder, inside it are RESTRICTED folders with your databases.
You can't actually see the size of your databases (that was my issue) from the Finder because the folder are protected, you can though see from the terminal with sudo du -sh /usr/local/mysql/data/{your-database-name} and like this you'll get a nice formatted output with the size.
In those folder you have different files with all the folders present in your database, so it's safer to check the db's folder to get a size.
That's it. Enjoy!
Well, if yo don't know where is my.cnf (such Mac OS X installed with homebrew), or You are looking found others choices:
ps aux|grep mysql
abkrim 1160 0.0 0.2 2913068 26224 ?? R Tue04PM 0:14.63 /usr/local/opt/mariadb/bin/mysqld --basedir=/usr/local/opt/mariadb --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/mariadb/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/iMac-2.local.err --pid-file=iMac-2.local.pid
You get datadir=/usr/local/var/mysql
On M1 and homebrew the "data directory" is:
/opt/homebrew/var/mysql
And the main path is:
/opt/homebrew/Cellar/mysql
Check where is the root folder of mysql with:
mysql_config
If you are using macOS {mine 'High Sierra'} and Installed XAMPP
You can find mysql data files;
Go to : /Applications/XAMPP/xamppfiles/var/mysql/
If you install MySQL via homebrew on MacOS, you might need to delete your old data directory /usr/local/var/mysql. Otherwise, it will fail during the initialization process with the following error:
==> /usr/local/Cellar/mysql/8.0.16/bin/mysqld --initialize-insecure --user=hohoho --basedir=/usr/local/Cellar/mysql/8.0.16 --datadir=/usr/local/var/mysql --tmpdir=/tmp
2019-07-17T16:30:51.828887Z 0 [System] [MY-013169] [Server] /usr/local/Cellar/mysql/8.0.16/bin/mysqld (mysqld 8.0.16) initializing of server in progress as process 93487
2019-07-17T16:30:51.830375Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-07-17T16:30:51.830381Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /usr/local/var/mysql/ is unusable. You can safely remove it.
2019-07-17T16:30:51.830410Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-07-17T16:30:51.830540Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.16/bin/mysqld: Shutdown complete (mysqld 8.0.16) Homebrew.
If you are using Homebrew to install MySQL#5.7, the location is
/usr/local/Homebrew/var/mysql
I don't know if the location is the same for other versions.
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