DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Ports and Packages

FreeBSD Ports and Packages Installation and upgrading of ports and packages on FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 8th December 2008
Mantazz Mantazz is offline
Shell Scout
 
Join Date: Oct 2008
Posts: 90
Thanked 0 Times in 0 Posts
Default MySQL problems in FBSD 6.2

I tried to install MySQL 5.1 today on my FreeBSD 6.2 box. I'm not sure exactly how to start the troubleshooting.

First thing I noticed is I don't have a 'mysqld' executable. I did a rehash, and I still don't find it. Does it reside someplace odd?

I do have /usr/local/bin/mysqld_safe and /usr/local/bin/mysqld_multi

I tried starting 'mysqld_safe', and the following resulted:
Code:
# /usr/local/bin/mysqld_safe
081207 19:54:00 mysqld_safe Logging to '/var/db/mysql/hostname.err'.
081207 19:54:00 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
081207 19:54:00 mysqld_safe mysqld from pid file /var/db/mysql/hostname.pid ended
I then tried to ping the mysql server with mysqladmin:
Code:
# mysqladmin ping
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!
I'm not sure what to do next. I installed 'mysql51-server', 'mysql51-client', and 'mysql51-scripts' all from ports after cvsup'ing my ports tree. I did not use and command line flags for compiling.

Last edited by Mantazz; 9th April 2009 at 09:58 PM. Reason: clearing out un-needed, identifying information
Reply With Quote
  #2   (View Single Post)  
Old 8th December 2008
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 699
Thanked 90 Times in 81 Posts
Default

You have to add the *_enable lines to /etc/rc.conf, and then use /usr/local/etc/rc.d/mysql-server start to fire it up. See the comments in the rc.d/ file for the variables you need to set in rc.conf.

This is documented in the rc(8), ports(7), and rc.conf(5) man pages, as well as the ports chapters in the Handbook.

Note: for the best performance on FreeBSD, use the 5.0.x series of MySQL.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
  #3   (View Single Post)  
Old 9th December 2008
Mantazz Mantazz is offline
Shell Scout
 
Join Date: Oct 2008
Posts: 90
Thanked 0 Times in 0 Posts
Default Still confused...

So I checked /usr/local/etc/rc.d/mysql-server and it said to add the following:
Code:
# Add the following line to /etc/rc.conf to enable mysql:
# mysql_enable (bool):  Set to "NO" by default.
#                       Set it to "YES" to enable MySQL.
# mysql_limits (bool):  Set to "NO" by default.
#                       Set it to yes to run `limits -e -U mysql`
#                       just before mysql starts.
# mysql_dbdir (str):    Default to "/var/db/mysql"
#                       Base database directory.
# mysql_args (str):     Custom additional arguments to be passed
#                       to mysqld_safe (default empty).
So in /etc/rc.conf, I added the following:
Code:
mysql_enable="YES"
mysql_limits="NO"
mysql_dbdir="/var/db/mysql"
mysql_args=""
Then I tried to start mysql with "sudo /usr/local/etc/rc.d/mysql-server start"

All I saw was "Starting mysql.", then nothing happened. I tried to query the server with "mysqladmin ping" and the response was
Code:
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!
I'm not sure what to do next. Any suggestions would be much appreciated - is there a way to get verbose output from "mysql-server start"?
Reply With Quote
  #4   (View Single Post)  
Old 9th December 2008
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 699
Thanked 90 Times in 81 Posts
Default

If this is a fresh install, you may also have to initialise the internal database and tables. The rc.d script is supposed to do this automatically, but sometimes it doesn't. Try running the following:
# /usr/local/bin/mysql_install_db
And then running the rc.d script.

If that doesn't work, check /var/log/messages and the mysql logs in /var/db/mysql.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
  #5   (View Single Post)  
Old 9th December 2008
Mantazz Mantazz is offline
Shell Scout
 
Join Date: Oct 2008
Posts: 90
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by phoenix View Post
If this is a fresh install, you may also have to initialise the internal database and tables. The rc.d script is supposed to do this automatically, but sometimes it doesn't. Try running the following:
# /usr/local/bin/mysql_install_db
And then running the rc.d script.

If that doesn't work, check /var/log/messages and the mysql logs in /var/db/mysql.

I ran the mysql_install_db command, and it ran without incident. I then tried to start mysql and it did nothing in particular. "mysqladmin ping" still returns the error
Code:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
/var/log/messages is useless for mysql, at least this installation of it. /var/db/mysql has a log file that appears almost hopeless.

Would it be at all useful to try uninstalling and reinstalling through ports, or do I have to muck through this by hand? It seems like there could be multiple missing things that are important to mysql, as the following lines from the /var/db/mysql log file indicate:
Code:
081209 12:09:03 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
081209 12:09:03 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
081209 12:08:33 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
081209 12:04:22 [ERROR] Can't start server : Bind on unix socket: Address already in use
081209 12:04:22 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
Reply With Quote
  #6   (View Single Post)  
Old 9th December 2008
Mantazz Mantazz is offline
Shell Scout
 
Join Date: Oct 2008
Posts: 90
Thanked 0 Times in 0 Posts
Default Found it

The problem was the permissions on one directory. The directory /var/db/mysql/mysql

Was owned by root, with permissions set to 700. Changing ownership to mysql corrected this problem and now mysql starts correctly and responds to ping.

Now I can start beating my head against the wall over SQL syntax instead ...

thanks
Reply With Quote
  #7   (View Single Post)  
Old 9th December 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

SQL Syntax is trivial, and MySQL has an excellent reference manual.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #8   (View Single Post)  
Old 23rd October 2009
unleashedpsycho unleashedpsycho is offline
New User
 
Join Date: Oct 2009
Posts: 1
Thanked 0 Times in 0 Posts
Smile Please help

Quote:
Originally Posted by phoenix View Post
If this is a fresh install, you may also have to initialise the internal database and tables. The rc.d script is supposed to do this automatically, but sometimes it doesn't. Try running the following:
# /usr/local/bin/mysql_install_db
And then running the rc.d script.

If that doesn't work, check /var/log/messages and the mysql logs in /var/db/mysql.
Dear Sir phoenix,
Mine is the same problem except mine's not fresh install.

"mysqladmin ping" shows the same message as mantazz i.e.
Quote:
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!
Reply With Quote
  #9   (View Single Post)  
Old 3rd November 2009
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,051
Thanked 198 Times in 156 Posts
Default

Quote:
Originally Posted by phoenix View Post
If this is a fresh install, you may also have to initialise the internal database and tables. The rc.d script is supposed to do this automatically, but sometimes it doesn't. Try running the following:
# /usr/local/bin/mysql_install_db
And then running the rc.d script.

If that doesn't work, check /var/log/messages and the mysql logs in /var/db/mysql.
You should run:
# mysql_install_db --user=mysql

Otherwise the ownership for the MySQL database are set to root:wheel, and since mysqld_safe is run as the mysql user ...

If you've already run mysql_install_db, then just remove the /var/db/mysql directory and re-run the command with the --user argument (Assuming, ofcourse, there is nothing of value in /var/db/mysql).
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash in FBSD 7.2 Mantazz FreeBSD Ports and Packages 8 5th October 2009 05:37 AM
dvb-t on FBSD? michaelrmgreen FreeBSD General 3 15th May 2009 10:43 AM
problems installing mysql port dejabu18 FreeBSD Ports and Packages 22 7th August 2008 09:23 AM
Eta Fbsd 7.1? michaelrmgreen FreeBSD General 7 7th June 2008 05:56 AM
mySql problems dctr FreeBSD Ports and Packages 3 25th May 2008 05:52 PM


All times are GMT. The time now is 06:55 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick