Mysql install on FreeBSD
I’ve had enough problems with this to know that I need to write down what I need to do to install mysql on FreeBSD. Here are the steps I took to do it successfully.
cd /usr/ports/databases/mysql41-server/
make install clean
/usr/local/bin/mysql_install_db
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
/usr/local/bin/mysqld_safe –user=mysql &
/usr/local/bin/mysqladmin -u root password newpassword
Edit 8/17:
{edit /etc/rc.conf and add}
mysql_enable="YES"
Thanks lucas
That works.

Michael Wilson Said,
July 10, 2005 @ 8:57 pm
Very nice. Most certainly saved some blood/sweat/tears/sanity.
Hope Hubris’s Photoblog » Blog Archive » Teh Blarg - Mysql install on FreeBSD Said,
July 10, 2005 @ 10:08 pm
[...] Teh Blarg » Mysql install on FreeBSD [...]
Raybdbomb Said,
July 11, 2005 @ 8:10 am
Good to hear.
guillermo Said,
July 24, 2005 @ 7:54 pm
diganme como debo iniciar el dota allstars 5.84b/5.84c
por que lo he descargado bien pero no me funciona.
afiantara Said,
July 31, 2005 @ 8:16 pm
I have try to install mysql in FreeBSD, as you have write down. but I have a problem that the FreeBSD is required the mysql41.1.10a.tar.gz, and I have try from the several web site which found that files, but freebsd is still anger for getting the suitable file ?
I have confused, what’s kind of file, could you help me for getting that file?
thanks
afiantara
RG Said,
July 31, 2005 @ 8:57 pm
Simply put, no BS, down to the point. Nice.
Marko Said,
August 4, 2005 @ 7:23 am
Exactly what I needed - simple and just working! Great!
lucas Said,
August 16, 2005 @ 10:22 pm
excellent. you forgot to edit /etc/rc.conf and add
mysql_enable=”YES” though…
Raybdbomb Said,
August 17, 2005 @ 7:41 pm
True.
danbra Said,
August 18, 2005 @ 4:48 pm
Thank you very much !!! This page made my day. I was close to take a shoot. lol Thx again ;D
danbra
WsL Said,
August 19, 2005 @ 8:39 am
can i use the AI in any version of DotA like DotA 6.10?
WsL Said,
August 19, 2005 @ 8:55 am
where do i put the AI file?
Raybdbomb Said,
August 19, 2005 @ 9:29 am
Erm… why are you commenting on this post?!?
Joel Mathias Said,
September 8, 2005 @ 2:52 pm
If you are using a custom data directory instead of /var/db:
cd /usr/ports/databases/mysql41-server/
make install clean
mkdir /data/db
/usr/local/bin/mysql_install_db –user=mysql –datadir=/data/db
chown -R mysql /data/db/mysql/
chgrp -R mysql /data/db/mysql/
/usr/local/bin/mysqld_safe –user=mysql –datadir=/data/db &
/usr/local/bin/mysqladmin –user=root password ‘newpassword’
/usr/local/bin/mysqladmin –user=root –password=newpassword shutdown
vi /etc/rc.conf
mysql_enable=”YES”
mysql_dbdir=”/data/db”
Marcus Macauley Said,
September 8, 2005 @ 2:56 pm
Your blog software formatted the double-hyphen before
user=mysqlas an en-dash. When I copied the command into my shell, it didn’t work, and it took me a while to notice what was wrong.I think you can get around the problem by changing
--user=mysqlto-u mysql.Raybdbomb Said,
September 8, 2005 @ 3:13 pm
Good catch, thanks.
Teh Blarg » Mysql Version Compatibility Issues Said,
September 13, 2005 @ 2:17 pm
[...] I initially thought to look in the configuration files to change the post-table output, but couldn’t find anything. I then tried looking for a table-output-templte, but wasn’t successful there either. I eventually just uninstalled 4.1.x and installed 4.0.x so that I wouldn’t have to worry about compatibility. [...]
madcow Said,
September 20, 2005 @ 5:53 am
thanks.
simple sweet instructions. cheers.
skan80 Said,
December 6, 2005 @ 3:28 am
studtest# /usr/local/bin/mysqladmin -u root password ‘0037′
/usr/local/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)’
Check that mysqld is running and that the socket: ‘/tmp/mysql.sock’ exists!
How do i want to solve the above prob? Can i just create a file named mysql.sock? Thanks
Quique Said,
December 22, 2005 @ 11:00 am
Should I also run something like
/usr/local/bin/mysqladmin -u root -h hostname.domain.net password ‘new-password’
or is not necessary?
Thanks
mustaufhi Said,
January 3, 2006 @ 6:55 am
i’ve made a program on win xp to make a connection to mysql server at freebsd?when i try to run the program i’ve a message ‘host 192.168.222.2 is not allowed to connect to this mysql server’,do someone know why?
note:192.168.222.2 is my ip address on win xp
192.168.222.5 is my freebsd4.3 ip address
Raybdbomb Said,
January 3, 2006 @ 9:04 am
You have to setup a user as coming either from * or 192.168.222.2. This isn’t a FreeBSD specific error, you can google for how to grant priveledges. Let me know if you can’t figure it out.
Steve Said,
March 6, 2006 @ 8:46 am
Humm… This HowTo works perfectly with mySQL 4.11 however, it does not work with 5.0 nor 5.1. Using the same steps, I’m getting an error message while trying to run “mysqladmin”:
“/usr/local/bin/mysqladmin: connect to server at ‘localhost’ failed
error: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
Check that mysqld is running and that the socket: ‘/tmp/mysql.sock’ exists!
Well, by issuing : ps -waux | grep mysql, I can see that the deamon is up and running…
Any advice? Thanks!
Raybdbomb Said,
March 6, 2006 @ 3:52 pm
I haven’t yet installed Mysql5, so I can’t really help you, sorry
Steve Said,
March 15, 2006 @ 6:42 am
Got MySQL 5.0.9-beta working! I just upgraded 4.1 using the steps provided here:
http://fak3r.com/articles/2005/11/15/howto-install-roundcube-webmail-from-cvs-on-freebsd
Basically:
3) Install MySQL:
/usr/local/sbin/portupgrade mysql-client
(if you have it currently installed) pkg_delete -r mysql-client-4.0.26
cd /usr/ports/databases/mysql50-client
make
cd /usr/ports/databases/mysql50-server
make
make install
/usr/local/bin/mysql_install_db
chown -R mysql /var/db/mysql/
Voilà!
Cheers.
Raybdbomb Said,
March 15, 2006 @ 7:29 am
Very cool, thanks!
vikash Said,
April 14, 2006 @ 5:59 am
HI,
this is vikash from india.i am install freebsd 6,but i am not configure mysql,can you guide me,
vikash
Raybdbomb Said,
April 14, 2006 @ 8:13 am
I think the above works for MySQL 4 on FreeBSD 6…
Mr. Magoo Said,
May 4, 2006 @ 9:46 pm
awesome. gave me what I was missing. Helped me get MySql 5.0 going on FreeBSD 6. Thanks for the help.
booyahgrandma Said,
May 13, 2006 @ 5:35 pm
Thanks, you’re a lifesaver (and not the crunchy, tasty kind)
Jacob Jennings Said,
May 25, 2006 @ 4:42 am
I LOVE YOU!!!!
Mysql install cheat sheet (freebsd ports) Said,
July 19, 2006 @ 9:03 am
[...] cd /usr/ports/databases/mysql41-server/ make install clean /usr/local/bin/mysql_install_db chown -R mysql /var/db/mysql/ chgrp -R mysql /var/db/mysql/ /usr/local/bin/mysqld_safe –user=mysql & /usr/local/bin/mysqladmin -u root password newpassword Edit 8/17: {edit /etc/rc.conf and add} mysql_enable=”YES” Thanks to Teh Blarg [...]
sputnik Said,
July 24, 2006 @ 9:30 am
checking for a BSD-compatible install… /usr/bin/install -c -o root -g wheel
checking whether build environment is sane… configure: error: newly created file is older than distributed files!
Check your system clock
configure: error: /bin/sh ‘./configure’ failed for libltdl
===> Script “configure” failed unexpectedly.
Please report the problem to ade@FreeBSD.org [maintainer] and attach the
“/usr/ports/devel/libtool15/work/libtool-1.5.18/config.log” including the
output of the failure of your make command. Also, it might be a good idea to
provide an overview of all packages installed on your system (e.g. an `ls
/var/db/pkg`).
*** Error code 1
Stop in /usr/ports/devel/libtool15.
*** Error code 1
whats then?
Raybdbomb Said,
July 24, 2006 @ 9:45 am
First, make sure it’s not already installed… of course.
Next, go to the MySQL port directory and make clean. Also, for /usr/ports/devel/libtool15.
Next, update your ports.
Finally, make install (again).
That should fix that issue…
sputnik Said,
July 24, 2006 @ 9:49 am
Thanks.:)
sputnik Said,
July 24, 2006 @ 10:08 am
Hm… almost same shit:
checking for a BSD-compatible install… /usr/bin/install -c -o root -g wheel
checking whether build environment is sane… configure: error: newly created file is older than distributed files!
Check your system clock
configure: error: /bin/sh ‘./configure’ failed for libltdl
===> Script “configure” failed unexpectedly.
Please report the problem to ade@FreeBSD.org [maintainer] and attach the
“/usr/ports/devel/libtool15/work/libtool-1.5.18/config.log” including the
output of the failure of your make command. Also, it might be a good idea to
provide an overview of all packages installed on your system (e.g. an `ls
/var/db/pkg`).
*** Error code 1
Stop in /usr/ports/devel/libtool15.
*** Error code 1
Raybdbomb Said,
July 24, 2006 @ 11:30 am
Get on #freebsd on your favorite IRC network and ask there. Or, if you prefer, http://freebsdforums.com
sputnik Said,
August 2, 2006 @ 8:05 am
Hi again. I’ve reinstalled freeBSD. I had 6, but now i installed 5.4. Is that wise choise? And i wanted to ask u another question: how to update the port tree by cvsup? Could u write me how to do it it step by step? thanks.:)
Raybdbomb Said,
August 2, 2006 @ 9:04 am
Hi sputnik-
I would not really have recommended going back down to an unsupported release. FreeBSD.org says 6.1 is now the stable release.
You can find out how to synch to the stable release here.
And as far as updating the ports tree, there’s a couple of ways. Here’s how I do it:
cd /usr/ports/net/cvsup-without-gui/ make install clean cp /usr/share/examples/cvsup/ports-supfile . { edit the ports-supfile and change the line that says *default host=CHANGE_THIS.FreeBSD.org to *default host=cvsup2.FreeBSD.org } { rehash if using sh } cvsup ./ports-supfileIt will take several minutes. There are other ways to do it, but that’s how I learned.
sputnik Said,
August 2, 2006 @ 9:06 am
Thanks, bro.:)
sputnik Said,
August 10, 2006 @ 12:32 am
I updated port tree, installed new FreeBSD, updated port tree again, then cleaned mysql directory, and i still can’t install neither - mysql40, 41, 50..:( Maybe the reason could be bad sectors in hdd? But i doubt, there is any bad sectors…
Last message:
===> Configuring for libtool-1.5.22_2
checking for a BSD-compatible install… /usr/bin/install -c -o root -g wheel
checking whether build environment is sane… configure: error: newly created file is older than distributed files!
Check your system clock
===> Script “configure” failed unexpectedly.
Please report the problem to ade@FreeBSD.org [maintainer] and attach the
“/usr/ports/devel/libtool15/work/libtool-1.5.22/config.log” including the
output of the failure of your make command. Also, it might be a good idea to
provide an overview of all packages installed on your system (e.g. an `ls
/var/db/pkg`).
*** Error code 1
Stop in /usr/ports/devel/libtool15.
*** Error code 1
Stop in /usr/ports/databases/mysql41-server.
Got any ideas, wtf it could be? Maybe i could send you ip and root’s pass, maybe you could check it out?
The bigest problem is, that i’m new to BSD and UNIX os’es..:)
Raybdbomb Said,
August 10, 2006 @ 7:39 am
sputnik Said,
August 10, 2006 @ 8:48 am
I live in Lithuania, it is a small country. In #FreeBSD channel on IRC there are only few guys, i’ve allready spoked with them. Forums - its to long way for me, i do not have time for siting and waiting for someone will write the right answer.
Raybdbomb Said,
August 10, 2006 @ 10:12 am
Hi Sputnik-
I helped you as much as I could. You can either go to a different irc network (I’d try efnet), or try out the forums, like I suggested. Asking here will make you wait even longer, because I really can’t help you.
Sorry!
sputnik Said,
August 10, 2006 @ 10:41 am
Ok, bro, thanks for help.:)
sputnik Said,
August 15, 2006 @ 9:32 am
Strange thing:)
Yesterday i tried to install mysql again, and everything was ok, i succeded!:) I really don’t know, what the hell is with that server..:)
Raybdbomb Said,
August 15, 2006 @ 1:19 pm
Good to hear
Raybdbomb Said,
September 1, 2006 @ 11:43 am
I used this again for mysql 4.1.21 on freebsd 6.1-release:
[root@burn /var/db/mysql]# mysql -V
mysql Ver 14.7 Distrib 4.1.21, for portbld-freebsd6.1 (i386) using 5.0
kucink Said,
February 8, 2007 @ 12:46 am
thanks a lot lot lot…
nutr Said,
February 10, 2007 @ 3:27 pm
Thank you for taking the time to write this.
Kyle White Said,
April 7, 2007 @ 8:45 am
I tried using these instructions for installing MySQL Server 5.0 from Ports. Everything worked fine, except running mysqld_safe directly as shown fails, but I got it working by running the mysql.server script with the ’start’ parameter. This must have been a change somewhere between 4.1 and 5.0. But anyway, it starts fine with the following command:
/usr/local/share/mysql/mysql.server start
Thanks for the useful instructions, though. They’re clear, and to the point!
Raybdbomb Said,
April 7, 2007 @ 9:45 am
Thanks for letting me know.
JamesH Said,
April 12, 2007 @ 3:32 pm
I wanted to let you know I’m posting a link to your entry on oscartheduck.wordpress.com, as these instructions are fantastic.
Raybdbomb Said,
April 12, 2007 @ 4:59 pm
Thanks for letting me know
wordpress on freebsd -- mysql install « oscartheduckin’ around Said,
April 12, 2007 @ 6:24 pm
[...] then followed fantastic directions for installing mysql on FreeBSD</a>. Read the comments [...]
Jadi Said,
July 7, 2007 @ 2:50 am
What a short and useful manual. I am a pro Linux user and right I am using for 5 minutes with a FreeBSD and just installed the MySQL5 on it. Wow… you rock !
dramisphere Said,
July 10, 2007 @ 10:48 pm
Thanks for the instructions!
noiq Said,
September 3, 2007 @ 11:26 am
Sputnik you have to set your system time!!
Freebsd literally tells you what the error is :
checking whether build environment is sane… configure: error: newly created file is older than distributed files!
Check your system clock
so set your date/time to current
using “date” command, e.g. today is Monday Sept 3rd, 2007
should be set as yymmddhhss - year month day hour seconds/minutes
so the command would be :
date 0709031519
Set up MySQL « FreeBSD notes Said,
September 28, 2008 @ 1:00 am
[...] Set up MySQL Sunday 28 September 2008 Posted by BKB in FreeBSD. trackback See http://raybdbomb.com/p/mysql-install-on-freebsd.html. [...]