Mac OS X MySQL Install
Installing MySQL 5.5.9 (updated for MySQL 5.5.16 and 5.5.18) on Mac OS X was on my list but it finally made the top. I needed to write instructions for a class that I teach because asking students who own a Mac to install VMWare and Windows before MySQL seems an unnecessary burden. Especially when you can install it directly on Mac OS X.
Mac OS X Mountain Lion (10.8.*) need to install XCode and Command Line Tools before installing MySQL. You can refer to this XCode installation and configuration post for those steps.
You can download MySQL for the Mac OS X. I downloaded the Mac OS X, Version 10.6 (x86, 64-bit) version for this installation. There were a couple shell syntax tricks beyond the instructions and then you need to configure database. That’s required because the database is installed with an unsecured anonymous and root account. After the step-by-step installation instructions, you’ll find the configuration steps to enable you to access the MySQL Monitor from a terminal session. It also configures your $PATH environment to enable you to start and stop the MySQL Daemon.
- After the download completes, open the file folder in the download directory.
- The open file folder and it will look like the following. Launch the
mysql-5.5.9-osx 10.6-x86_64.pkgfile, which installs the product.
- After launching the executable, you are now on the first page of the Install MySQL 5.5.9 installation application. Click the Continue button.
- This page contains the instructions, you can pause to read them or continue with these instructions. Click the Continue button to proceed.
- This page contains the General Public License (GPL). You agree or stop the installation. Click the Continue button to proceed.
- The following overlay dialog contains your agreement. Click the Agree button to proceed.
- There are fewer options in this installation than the Windows installation. While you can change the installation location, the software installs by default in the
/usr/local/mysqldirectory. The installation requires that you have amysqluser account on the operating system, and you don’t need to do anything because one exists as part of the default Mac OS X installation. Click the Install button to proceed.
- This dialog requires the system administrator’s password. Enter the valid password and click the OK button to proceed.
- Depending on the system, this could take more than a minute. All you can do it wait.
- This page tells you that you’ve completed the installation. Click the Close button to proceed.
- This step requires that you return to the download folder, shown in Step #2 above. Launch the
MySQLStartupItem.pkgand you’ll see the following MySQL Startup Item Installer dialog. Click the Continue button to proceed.
- This page contains the instructions for the MySQL Startup software, you can pause to read them or continue with these instructions. Click the Continue button to proceed.
- This page asks if you want to change the directory. I’d recommend you leave it as the default because it requires the System Administrator’s password to start and stop the database. It should also start for you every time you boot the machine. Click the Continue button to proceed.
- Like Step #8, this dialog requires the system administrator’s password. Enter the valid password and click the OK button to proceed.
- You could see a progress dialog box but generally it happens so fast you should land at the Installation was Successful dialog. Click the Close button to proceed.
- This step requires that you return to the download folder, shown in Step #2 above. Launch the
MySQL.prefPaneand you’ll see the following MySQL Preferences dialog. Click the Install button to proceed.
- Like Step #8 and #14, this dialog requires the system administrator’s password. Enter the valid password and click the OK button to proceed.
- Don’t click in the automatic start button unless you’re sure. Otherwise, there’s a lot of cleanup to be able to return to this point and start or stop the server as required. This is the last screen, you should click the Start MySQL Server button to start MySQL. While installing MySQL 5.5.18 I discovered that the service menu is no longer installed in the Preferences, and you must start it manually.
You can start and stop the service by opening your System Preferences, where you’ll find them in the bottom Other row. If the intent was to have it start automatically, sometimes the permissions are incorrect. You’ll get the following error in MySQL 5.5.9 but not in MySQL 5.5.16 because the MySQL DMG file is fixed. You can skip the instructions until you get to Configure User’s Shell Environment below:
"/Library/StartupItems/MySQLCOM" has not been started because it does not have the proper security settings. |
You can fix this by changing the permissions manually in a Terminal Session. Launch a Terminal Session from your Utilities folder inside your Applications folder.
Change directory to the /Library/StartupItems/MySQLCOM directory. Then, list the files. These commands should do the trick for you:
cd /Library/StartupItems/MySQLCOM ls -al |
If you see these permissions, you have problem because the group for startup files should be wheel not staff:
drwxr-xr-x 4 root staff 136 Jan 20 13:46 . drwxr-xr-x 4 root wheel 136 Feb 9 21:11 .. -rwxr-xr-x 1 root staff 1300 Jan 20 13:46 MySQLCOM -rw-r--r-- 1 root staff 469 Jan 20 13:46 StartupParameters.plist |
You can change the files with this command:
sudo chown root:wheel * |
However, now you need to step up the directory tree one level to /Library/StartupItems, and change the ownership of:
drwxr-xr-x 4 root staff 136 Jan 20 13:46 MySQLCOM |
There are two commands to do this. The first changes directory by moving to the parent directory in the hierarchy (the parent directory is represented by two dots). The second changes the group ownership of the MySQLCOM directory.
cd .. sudo chown root:wheel MySQLCOM |
Now you need to configure your shell environment and harden the database. Hardening means securing accounts with passwords. They’re covered in the next two sections.
Configure User’s Shell Environment
Assuming you accepted the defaults, you should be able to copy the required instructions directly into a .bash_login file if one exists. Unless you’ve created one before there won’t be a file. Mac OS X doesn’t automatically create the file. If you don’t have the file, you can create one with the following syntax:
touch .bash_login |
You can open the file with the vi editor or a text editor of your choice. MySQL 5.5.9 installed in /usr/local/mysql, which has changed to /usr/local/mysql-version as noted below. You can copy the following contents into the file for MySQL 5.5.16 but will need to change the file for earlier or later releases (added sudo per Don McArthur’s comment):
# Set the MySQL Home environment variable to point to the root directory of the MySQL installation. export set MYSQL_HOME=/usr/local/mysql-5.5.16-osx10.6-x86_64 # Add the /bin directory from the MYSQL_HOME location into your $PATH environment variable. export set PATH=$PATH:$MYSQL_HOME/bin # Create aliases that make it easier for you to manually start and stop the MySQL Daemon. alias mysqlstart="sudo /Library/StartupItems/MySQLCOM start" alias mysqlstop="sudo /Library/StartupItems/MySQLCOM stop" |
Changes between MySQL 5.5.16 and 5.5.18 introduce a new directory structure, you need to use the following in the .bash_login file (added sudo and status per Don McArthur’s comments):
# Set the MySQL Home environment variable to point to the root directory of the MySQL installation. export set MYSQL_HOME=/usr/local/mysql-5.5.18-osx10.6-x86_64 # Add the /bin directory from the MYSQL_HOME location into your $PATH environment variable. export set PATH=$PATH:$MYSQL_HOME/bin # Create aliases that make it easier for you to manually start and stop the MySQL Daemon. alias mysqlstart="sudo /Library/StartupItems/MySQLCOM/MySQLCOM start" alias mysqlstop="sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop" alias mysqlstatus="ps aux | grep mysql | grep -v grep" |
As pointed out by Shashank’s comment, you should now use the following aliases:
alias mysqlstart='sudo /usr/local/mysql/support-files/mysql.server start' alias mysqlstop='sudo /usr/local/mysql/support-files/mysql.server stop' |
You need to save the file and close and restart a new Terminal session to place these environment variables in scope. You could also run the following to put them in scope without closing and opening the terminal:
. ./.bash_login |
The preceding command sources the environment file into active memory. This should configure your environment. After restarting the shell, you should be able to run this command to confirm the new environment:
which -a mysql |
It should return:
/usr/local/mysql-5.5.16-osx10.6-x86_64/bin/mysql |
Secure the Database
This is presently necessary because of the different file structure in a Mac OS X MySQL install, which disables the mysql_secure_installation file from running successfully. You can manually edit the file or follow these steps.
You need to connect to the database as the privileged super user, root user. This is simple because the installation doesn’t set any passwords. You open another Terminal session to make these changes or you could install MyPHPAdmin or MySQL Workbench. The tools work as well in fixing the majority of issues.
mysql -uroot |
Once connected to the database as the root user, you can confirm that passwords aren’t set and an insecure anonymous user account has been previously configured. You do that by connecting to the mysql database, which is the database catalog for MySQL. You do that by running the following command:
USE mysql; |
You can query the result set with the following query:
SELECT USER, password, host FROM USER\G |
You should see the following output plus the user’s name preceding the MacPro (or iMac.local) host name value:
*************************** 1. row ***************************
user: root
password:
host: localhost
*************************** 2. row ***************************
user: root
password:
host: MacPro.local
*************************** 3. row ***************************
user: root
password:
host: 127.0.0.1
*************************** 4. row ***************************
user: root
password:
host: ::1
*************************** 5. row ***************************
user:
password:
host: localhost
*************************** 6. row ***************************
user:
password:
host: MacPro.local |
You now need to change the password for the root user. I would suggest that you do this with the SQL command rather than a direct update against the data dictionary tables. The syntax to fix the root user account require you enter the user name, an @ symbol, and complete host values, like:
SET PASSWORD FOR 'root'@'localhost' = password('cangetin'); SET PASSWORD FOR 'root'@'MacPro.local' = password('cangetin'); SET PASSWORD FOR 'root'@'127.0.0.1' = password('cangetin'); SET PASSWORD FOR 'root'@'::1' = password('cangetin'); |
You should be able to drop both anonymous user rows with the following syntax, but I did encounter a problem. Assuming you may likewise encounter the problem, the fix follows the first commands you should try:
DROP USER ''@'localhost'; DROP USER ''@'MacPro.local'; |
If either of the anonymous accounts remain in the USER table, you can manually drop them from the database catalog. This syntax will get rid of them:
DELETE FROM USER WHERE LENGTH(USER) = 0; |
You’ve completed the configuration and can now type quit; to exit the MySQL Monitor. To reconnect, you’ll now need a password, like this:
mysql -uroot -pcangetin |
Also, don’t forget to use a real password. The one shown here is trivial, which means easy to hack. Use something that others might not guess.
Configure my.cnf file
You can copy one of the sample configuration files as a starting point (as provided by Don McArthur’s comment):
sudo cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf |
Starting and Stopping the Database
You can manually start the database server with the following command, which you defined as aliases in your .bash_login shell script:
mysqlstart |
Stopping it is also straightforward, you do this:
mysqlstop |
You can check it’s status with this command:
mysqlstatus |



















[...] This post was mentioned on Twitter by mclaughj rss and OraNA.info, Yosuke KATSUKI [...]
Tweets that mention post
10 Feb 11 at 3:53 am
Wonderful instructions. Very detailed.
I also like to install mysql using homebrew. You can get homebrew from here:
https://github.com/mxcl/homebrew
Then from the terminal, just type:
brew install mysql
When it is finished, it gives you a couple of instructions for initializing your database, setting it up to run on startup if you want, and startup and shutdown via terminal commands.
(Note: this method requires that you have XCode installed because it compiles mysql from source)
Hope that helps some.
Mike Farmer
10 Feb 11 at 12:39 pm
Hi,
I had earlier installed mysql-5.1.50-osx10.6-x86_64.dmg and then uninstalled it using the below belo command (found in stackoverflow)
Then I have tried to reinstall from mysql-5.5.9-osx10.6-x86_64.dmg.
However I am getting the below error:
The installation failed The installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
Sarbbottam Bandyopadhyay
21 Feb 11 at 10:42 am
Everything works fine until I get to the step where I enter
mysql -urootand my computer returns this error:Also in the mysql startup window it lists the following under the startup button:
I’m new to navigating Unix and don’t know what to do next. Do you have any suggestions for how I handle the ownership?
Katie
23 Feb 11 at 11:55 am
It appears you may need to add the password (the generic password that I use is
cangetin), likemaclochlainn
23 Feb 11 at 12:23 pm
Nope. no change.
Katie
23 Feb 11 at 2:30 pm
Katie, That was a quick thought from iPad earlier today, but looking at the message you posted, it appears you’ve opted for a different installation plan. The expected location for MySQL is the
/usr/localdirectory. In that directory, you should find the following:If you’ve manually installed the files position the directory with the release name, like that shown above. Create a
mysqllink that points to the directory where you installed the MySQL database home.Inside the physical
mysql-5.5.9-osx10.6-x86_64directory, you should find these files. Everything should be owned by therootuser and have the primary group aswheelgroup, except for the data files which are owned by the_mysqluser.maclochlainn
23 Feb 11 at 10:12 pm
I couldn’t start the MySQL server after the first initial install using the system preferences pane and I couldn’t start it up using the alias created in the .bash_login file that I created following the instructions in this post either. I went searching around for a solution. The instructions in the following link fixed it for me. Hope this helps.
http://forums.mysql.com/read.php?11,399397,399606#msg-399606
Nate
10 Mar 11 at 7:37 pm
Installed and got the server running. But I can’t seem to login as root with no password.
Attempted …
But I’m able to login by just entering ./mysql (no username, no password) but `show databases` doesn’t show mysql.
amtec
16 Oct 11 at 9:34 pm
I’d need more information to help you. What version did you download and install?
It appears that you’ve logged in as the
anonymoususer and have no permissions to see databases other than theinformation_schemadatabase. Can you see theinformation_schemadatabase? Did you provide a password during configuration?maclochlainn
16 Oct 11 at 9:48 pm
What version did you download and install?
mysql-5.5.13-osx10.6-x86_64.dmg
Can you see the information_schema database?
Yes
Did you provide a password during configuration?
No
amtec
16 Oct 11 at 10:12 pm
The easiest thing is to simply disable security and reset the root password. The instructions for Windows are here. The only difference is that you’ll need to edit the file as
rootand the file ismy.cnf. If you don’t want to do this, then the uglier observation and alternative follows below.The good news is that you’re connecting as the anonymous user, the bad news is that root may not exist. You can run the following command inside the
information_schemadatabase, and if it returns zero you’ll need to re-install or snag copies ofuser.MYD.gz,user.MYI.gz, anduser.frmfrom a working instance and put them in the/usr/local/mysql-5.5.13-osx10.6-x86_64/data/mysqldirectory.Alternatively, you could opt for the one I installed for the post, which worked well.
maclochlainn
16 Oct 11 at 11:35 pm
I have Mac OSX10.7 and Mamp Pro. I was using Mamp Pro trial and it all worked fine, but since I purchased a license key (must be updated version) I can no longer access my WordPress site on localhost. Message says “The requested URL /wordpress/ was not found on this server.”
I have posted my question in several forums with no solution, and was hoping maybe you might have a suggestion. Thanks for reading my comment.
Sharon
26 Oct 11 at 4:50 am
I’d recommend you inspect the
httpd.confto verify that you’ve got a/wordpress/virtual directory configured. You may also check this MAMP blog post.maclochlainn
26 Oct 11 at 8:53 pm
Excellent instructions. Only two comments:
(1) Instead of mysql -uroot, I had to type ./mysql -uroot and
(2) It gave me the error message: “ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)”, but then when I typed “./mysql -h 127.0.0.1 -u root -p” and it asked for the password, then it worked…I could login as root.
Thanks.
Amrapali
16 Feb 12 at 3:04 am
Hi,
I found this post which is really great. I could follow it to the dot until it came to configure the user’s shell environment. First I tried to create the .bash_login file which didn’t exist but the instructions posted never worked, so I managed to create the file myself using BBedit and placing it in the /usr/local/myssql-5.5.22-osx10.6-x86_64 folder. But from there on I just couldn’t move forward.
When I try to use mysql in a webpage I get a “Could not connect: Access denied for user ‘root’@'localhost’ (using password: YES)” error. I suppose that the problem is that the environment is not correctly set. I’m very new to mac and the terminal. Can anyone help?
Alegra
7 May 12 at 8:50 am
I’m not sure from what you’ve written which command isn’t working. Could you provide the command that generates the errors?
maclochlainn
9 May 12 at 10:56 pm
Amazing! Thanx a lot!
Matina
2 Jun 12 at 10:22 am
I have error too..
can you tell detail with specifics instruction and give picture of all not just for install but for before first used my sql..
Thanks
Mike
7 Jun 12 at 2:54 am
Take a look at the bottom of this blog entry.
maclochlainn
7 Jun 12 at 8:39 am
[...] the MySQL installation I turned to Michael McLaughlin’s blog. MySQL has a simple implementation for Mac OS X. You can download an OS X Disk Image of [...]
Fanning the Flames… Working with OpenFlame from FireJack Technologies | Health, Vitality and Technology
21 Aug 12 at 10:56 pm
My Mac OS is Lion, I installed the MySQL according to this manual, and when I use the
mysqlstartandmysqlstopcommand, it prompt thatis a directory, but the
MySQLCOMis a shell script, what happend here? MySQL version isMySQL Version 14.14 Distribution 5.5.27, for osx10.6 (i386) using readline 5.1.
coanor
19 Sep 12 at 2:09 am
Excellent tutorial! Thanks!
mang
22 Sep 12 at 10:01 pm
Very good HowTo! Thx a lot!
Romain
22 Oct 12 at 2:01 am
Hi,
just wanted to say thanks for a quick and concise how-to. I just wanted to get MySQL running quickly on my Mac mini and your information was invaluable.
Thanks again.
Scott
28 Oct 12 at 7:45 pm
One of the better mysql installation on OS X HOWTOs I’ve seen. I would make one change and one addition:
The aliases for starting and stopping the daemon from the command line should be (adding sudo):
The addition is as follows – the installation does not include a mysql server options file. The server will run without one, but you cannot do the necessary settings tuning for optimal performance. The installation does include samples – you can copy one (use the biggest) to get you started:
Even those suggested settings are too small for modern hardware, but that’s a good education in itself.
Nice job!
Don McArthur
13 Nov 12 at 11:11 am
Don, Thanks for the feedback. It’s incorporated in the post now.
maclochlainn
13 Nov 12 at 12:04 pm
maclochlainn, You’re welcome.
Final tweaks – your aliases mysqlstart and mysqlstop pass the ‘start’ and ‘stop’ arguments to MySQLCOM, so those options don’t need to be used on the cli and are in fact ignored. ‘>mysqlstart’ and ‘>mysqlstop’ are sufficient.
I’ve also added the following alias because MySQLCOM does not accept an argument of ‘status’:
Look for mysqld and mysql_safe in the output.
Don McArthur
14 Nov 12 at 6:37 am
Hi, may i know why my mac terminal shows that the permission is denied when I enter touch .bash_login ?
sweety
14 Nov 12 at 6:50 pm
Are you working in a directory owned by your user? Generally, this type of error only occurs when you try to touch a file in a directory you don’t own.
This should work in any directory:
maclochlainn
14 Nov 12 at 9:03 pm
Don, Thanks, again. I’ve added it to the post.
maclochlainn
14 Nov 12 at 11:52 pm
Why does it sayE45: ‘readonly’ option is set (add ! to override), when I try to enter the given contents into the file .bash_login using vi editor?
sweety
15 Nov 12 at 10:43 pm
Please check the following file:
It should find that file with the following permissions:
Check if that’s your user name with:
whoamiIf it’s not got those permissions, you should be able to assign those permissions:
Hope this helps. If not post a followup question.
maclochlainn
16 Nov 12 at 12:51 am
Hi, I did type
ls -al .bash_login, but it does not show any mac user name as you said. It just enters as following,However, it does not allow me to edit with vi the file once again.
sweety
16 Nov 12 at 8:24 am
Hey the ls -al .bash_login worked for me. But, the further displays this way:
Why do these happen?
After closing the terminal and reopening it and typing which -a mysql, it displays this way:
But, does not return the path as you said. Please let me know the case.
sweety
16 Nov 12 at 11:05 am
Can you let me know which Mac OS X you’re running? You can find it at the terminal like this:
sw_vers -productVersionIs the machine yours or a company machine? If the latter, it appears they’ve changed ownership of files. However, it appears your user is in the sudoer group. That means you should be able to edit it by using
sudoor creating arootshell. You create arootshell as a sudoer with this syntax:maclochlainn
16 Nov 12 at 11:27 am
It is 10.7.5. It is my laptop and not a company machine.
sweety
16 Nov 12 at 1:06 pm
May I know how do I do it for 10.7.5 mac OS owned by me please?
sweety
16 Nov 12 at 7:10 pm
Its unclear how the file ownership changed from the default settings but they should be as noted earlier. The best way to precede is to know whence you came. Did you issue a
chowncommand in the home directory? You can run the following command from the default terminal location, which should be your home directory:pwdIt should return, the following where macuser is your user name:
Determine if you changed one or all files by issuing an
ls -alcommand in your home directory. In the listing, it appears you may see results like the following:The ownership displayed for the
.(dot) or present working directory, should be the ownership for everything in that directory. That includes subdirectories (or folders). If you see that all files have arootowner andwheeldefault group, change them back to what they should be in a normal Mac OS X installation. You need to act as sudoer or root to make the change back. This command should do that for you, and enable you to complete the instructions.This should fix your problem. If it doesn’t let me know.
maclochlainn
16 Nov 12 at 10:40 pm
As you said, the following is the resultant:
sweety
16 Nov 12 at 11:01 pm
Now, please let me know what is the next procedure I am supposed to take. Thank you.
sweety
16 Nov 12 at 11:03 pm
Aren’t you able to use
vito edit the.bash_loginfile now?maclochlainn
16 Nov 12 at 11:32 pm
I installed mysql 5.5.28. So, which version shall I edit in the vi file? Is it the same that you entered in the installation steps i.e.,
Or am I supposed to make changes to that in vi file? Please let me know.
sweety
17 Nov 12 at 7:55 am
Could you please let me know what contents do I need to enter in the vi file for Mac 10.7.5 with mysql 5.5.28 version?
sweety
17 Nov 12 at 9:36 am
First, let’s make sure you know where the directory for the MySQL home is:
Let’s assume that returns
mysql-5.5.28-osx10.6-x86-64as a result, then you should enter this in your.bash_loginfile:Hope this helps you …
maclochlainn
17 Nov 12 at 12:12 pm
I have mysql v5.4.4 on my mac working as a local host. I am receiving an error message, but the website I am working on works fine on the remote server. I discovered the remote server is running 5.1.66. So, I want to install that version on my mac to match the remote server. Any suggestions? Will I run into any difficulties? I can download the 5.1.66 version. By the way, I established the local server using MAMP.
William
17 Nov 12 at 3:49 pm
I don’t think that you should. Let me know if you do?
maclochlainn
17 Nov 12 at 4:21 pm
I get this now when I open my vi file..
E325: ATTENTION Found a swap file by the name ".bash_login.swp" owned by: laxmipandrapragada dated: Sat Nov 17 10:34:59 2012 file name: ~laxmipandrapragada/.bash_login modified: YES user name: laxmipandrapragada host name: Laxmis-MacBook-Pro.local process ID: 5677 While opening file ".bash_login" dated: Sat Nov 17 10:10:52 2012(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use “:recover” or “vim -r .bash_login”
to recover the changes (see “:help recovery”).
If you did this already, delete the swap file “.bash_login.swp”
to avoid this message.
Swap file “.bash_login.swp” already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
How do I solve this case? Please let me know..
sweety
17 Nov 12 at 10:19 pm
You can delete the
*.swpfile. It’s a temporary file, like those created by word processing software. Alternative, choose edit anyway.maclochlainn
17 Nov 12 at 11:11 pm
Thanks you for your patience. I finished doing all the installation steps as above. But, once I restarted the terminal, it shows an error:
Please let me know how to resolve the case.
sweety
18 Nov 12 at 7:29 am
That’s not a bad message because it says the MySQL (
mysqldprocess) is running. It says you have a password set for the instance. My assumption is that you don’t know the password, but if you do the easiest thing is to connect this way:If you don’t have the password, you can use this post on resetting the MySQL
rootaccount. The only difference is that on Windows the option file ismy.ini, whereas on Mac OS X it ismy.cnf.maclochlainn
18 Nov 12 at 10:08 am
[...] Mac OS X, Mountain Lion (10.8.x), requires some pre-steps [...]
Mountain Lion Pre-step for MySQL
10 Dec 12 at 8:55 pm
Hi, just wanted to say thanks for the nice work. I’ve followed each step and mysql is working perfectly on my machine. The only problem i’m facing is alias “mysqlstart” is not working for me, else all other aliases are working fine for me like “mysqlstop”, “mysqlstatus”. I even added one more alias “mysqlrestart” and its also working perfectly fine.
What could be the reason for “mysqlstart”? am i making any mistake here? Version of my OS X is 10.8.2
Thanks in advance for your help.
Regards, Jagdish
Jagdish
11 Dec 12 at 2:19 am
Can you post your
.bash_logincontents?maclochlainn
11 Dec 12 at 11:05 am
Hi,
I get the following error message:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (2)
I downloaded mysql-5.5.29-osx10.6-x86_64.dmg and installed according to the instructions above.
I run a Mountain Lion (10.8.2) Server (MacMini Server).
I installed it with the admin account.
The file ‘/var/mysql/mysql.sock’ do exist.
I think I’ve tried everything but still have this issue.
Would appreciate the help!
Sincerely,
Andreas
Andreas
24 Dec 12 at 2:36 pm
Andreas,
Could you run this to confirm that the MySQL daemon is running?
Let me know, thanks.
maclochlainn
24 Dec 12 at 10:09 pm
Hi Maclochlainn,
thank you for taking time to answer.
When I run the above mentioned command, I get the following output:
I would guess that the MySQL daemon is not running?
Sincerely,
Andreas
Andreas
25 Dec 12 at 1:59 am
Andreas, That’s right the MySQL daemon isn’t running. The command to start it is noted above.
maclochlainn
25 Dec 12 at 9:45 am
Merry Christmas by the way!
I’ve tried the
mysqlstartcommand that has been added in the.bash_loginfile. Nothing happens.I’ve also tried “mysqlstatus” but that returns nothing either.
I checked in System Preferences and noticed that the MySQL added preference shows that “MySQL Server Instance is stopped” and when clicking “Start MySQL Server” it asks for my user password (Administrator which I am logged in with and installed it with) but then nothing happens at all.
What to do now?
Any log that I can read what goes wrong maybe?
Or should I remove (uninstall) everything and try again?
I am very thankful for your support!
Sincerely,
Andreas
Andreas
25 Dec 12 at 10:24 am
Andreas,
A belated Merry Christmas. Could you run these commands from the Terminal:
If you find a MySQLCOM directory, change into that directory and list it’s contents.
Thanks,
Michael
maclochlainn
26 Dec 12 at 11:52 pm
Great post.
I was foolishly copied this line
and was wondering why it is not working. My version was little different.
Satya
30 Dec 12 at 11:28 pm
Satya, I think you already made the change but if not you should put the directory name in that path changes with release.
maclochlainn
31 Dec 12 at 9:34 am
thanks so much for such a thorough instruction! best I’ve seen!
Chelsea
1 Jan 13 at 8:01 pm
Hello there,
It was a great post. I followed the instructions as is and I installed
mysql-5.6.9-rc-osx10.7-x86_64.dmgfrom developer tools.I set the
MYSQL_HOMEaccordingly. After I changed the security passwords and copying the conf file. For this package theI used
my-default.confinstead of my-huge.cnf.I logged out and stopped the MySQL Server from the window and started the server with mysqlstart, I get the below error when I type the
I think I need the correct config file. Can you tell me where I can find the correct config file for this version.
Jyothi
Jyothi
18 Jan 13 at 3:33 am
Can you check if the mysqld process is running?
maclochlainn
28 Jan 13 at 11:17 pm
After following these steps I had problem starting MySql server from command line because of which I was getting this error when I try to connect:
So I changed my aliases to:
now it is working fine.
Also I have done this:
Shashank
3 Feb 13 at 2:56 am
Great update, thanks!
maclochlainn
3 Feb 13 at 10:37 am
Dear maclochlainn,
thank you very much for your detailed instructions. I think I have come pretty far, but like Jyothi, I did not think I had the right .cnf file. I also used my-default.cnf instead. Then I entered the 2 alias lines from Shashank. Now the server is starting and stopping perfectly with mysqlstart and mysqlstop respectively. So a big thank you to all.
Richard
Richard
23 Feb 13 at 8:07 am
Exellent post! Thanks!
Anders
26 Feb 13 at 3:05 am
It is a very nice posting. Sashank’s tip helped me when i was struggling for the same error. It saved me a lot of time.
Mac: Appreciate if you can update the steps with the new inputs from Sashank.
great posting!!!
Srini Kadiyala
28 Feb 13 at 3:45 am
You can’t imagine how thankful I am for this blog post of yours. Moving from Windows, configuring MySQL on MAC has been a nightmare just because of the permissions. Your detailed instructions helped me try to understand why I am doing what. The only changes I need to made was Shashank’s way of adding aliases. I configured this on a Mac 10.8. A big thank you to all. I think I literally encountered all the errors everyone has got.
HJR
2 Mar 13 at 12:36 pm
I got a chance to update the post today. Let me know if you think it works?
maclochlainn
2 Mar 13 at 2:01 pm
Thanks, I’ve updated the post with the new aliases.
maclochlainn
2 Mar 13 at 2:02 pm
These are the instructions that should be on the official MySQL website. Great job! If only all tech setup instructions were this clear and helpful. many thanks maclochlainn.
Carlos
10 Mar 13 at 12:19 pm
These instructions are excellent and got mySQL up and running on my iMac easily and quickly. Thanks so much for posting these instructions maclochlainn
Terry
13 Apr 13 at 4:17 pm
I did all the way to the command . ./.bash_login
the answer was: -bash: ./.bash_login: No such file or directory
and for which -a mysql
there wasn’t any response at all.
i am using mountain lion 10.8.3
installing mysql version mysql-5.6.11-osx10.6-x86_64
i am totally new into mac, but i used to work on linux before….long time ago….so i forgot some of the basics…
my questions are:
where .bash_login should be create (under which path)
after i edited the .bash_login how should i restart the shell
why both commands don’t have response like you wrote here
Jonny
16 May 13 at 12:10 am
It should be in your user’s home directory:
maclochlainn
17 May 13 at 5:46 pm
thanks, i moved my .bash_login to /Users/myusername and now i can start and stop mysql server from mysqlstart and mysqlstop command, also mysqlstatus works.
but which -a mysql have no any response.
can you help me with that please?
my .bash_login path is # Set the MySQL Home environment variable to point to the root directory of the MySQL installation.
export set MYSQL_HOME=/usr/local/mysql-5.5.11-osx10.6-x86_64
# Add the /bin directory from the MYSQL_HOME location into your $PATH environment variable.
export set PATH=$PATH:$MYSQL_HOME/bin
Jonny
19 May 13 at 3:14 am
ok i found my mistake it was the mistake in the path itself/usr/local/mysql-5.5.11-osx10.6-x86_64
instead of/usr/local/mysql-5.6.11-osx10.6-x86_64
but now when i write echo $PATH it also return me the/usr/local/mysql-5.5.11-osx10.6-x86_64
and /usr/local/mysql-5.6.11-osx10.6-x86_64
how to delete it
Jonny
21 May 13 at 1:34 am