Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
MySQL not working
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Craig_Williamson
n00b
n00b


Joined: 04 Mar 2003
Posts: 65
Location: New Zealand

PostPosted: Thu Sep 11, 2003 5:34 am    Post subject: MySQL not working Reply with quote

Hi All,

I emerged the mysql-4.0.14-r1 ebuild and I can't get mysql to work. This is the error I am getting:
Quote:

ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


It appears that the file is missing. How do I get the file to appear on my system. If anyone could help it would be appreciated.

Craig
Back to top
View user's profile Send private message
devon
l33t
l33t


Joined: 23 Jun 2003
Posts: 943

PostPosted: Thu Sep 11, 2003 7:36 am    Post subject: Reply with quote

Did you following the ebuild? :)
Quote:
You might want to run: "ebuild /var/db/pkg/dev-db/mysql-4.0.14-r1/mysql-4.0.14-r1.ebuild config" if this is a new install.
Back to top
View user's profile Send private message
Craig_Williamson
n00b
n00b


Joined: 04 Mar 2003
Posts: 65
Location: New Zealand

PostPosted: Thu Sep 11, 2003 10:34 am    Post subject: Reply with quote

Thanks for the suggestion, but it didn't work.

Quote:

* Hmm, it appears as though you already have the mysql
* database in place. If you are having problems trying
* to start mysqld, perhaps you need to manually run
* /usr/bin/mysql_install_db and/or check your config
* file(s) and/or database(s) and/or logfile(s).


The same error comes up. Does anyone else have any ideas?

Thanks again.

Craig
Back to top
View user's profile Send private message
ralph
Advocate
Advocate


Joined: 02 Mar 2003
Posts: 2001
Location: Hamburg

PostPosted: Thu Sep 11, 2003 11:28 am    Post subject: Reply with quote

Sorry for the stupid question, but are you sure you started mysql?
Also, what are you trying to do, when you get the error?
Back to top
View user's profile Send private message
Craig_Williamson
n00b
n00b


Joined: 04 Mar 2003
Posts: 65
Location: New Zealand

PostPosted: Thu Sep 11, 2003 7:40 pm    Post subject: Reply with quote

Hi There,

The problem is when I start mysql. The /var/run/mysql/mysqld.sock file should appear after the startup script is run. It is not being created.

Also at the moment, when I try and stop mysql it throws up an error and won't stop the service.

Hope this helps.


Craig
Back to top
View user's profile Send private message
ralph
Advocate
Advocate


Joined: 02 Mar 2003
Posts: 2001
Location: Hamburg

PostPosted: Thu Sep 11, 2003 8:17 pm    Post subject: Reply with quote

Hi, did a quick search and it seems, that several people have that problem.
It seems that there is a problem with the init script, if you don't do an etc-update. Take a look:

https://forums.gentoo.org/viewtopic.php?t=71653&highlight=mysql+socket
https://forums.gentoo.org/viewtopic.php?t=68248

Good luck! :D
Back to top
View user's profile Send private message
Craig_Williamson
n00b
n00b


Joined: 04 Mar 2003
Posts: 65
Location: New Zealand

PostPosted: Fri Sep 12, 2003 5:40 am    Post subject: Reply with quote

It didn't work. I did the etc-update and once I got my system back up and running it still wouldn't work. Any other ideas?


Craig
Back to top
View user's profile Send private message
thunder
Retired Dev
Retired Dev


Joined: 01 Sep 2003
Posts: 164
Location: Wroclaw, PL

PostPosted: Fri Sep 12, 2003 6:00 am    Post subject: Reply with quote

run
Code:
mysql_install_db

_________________
Damian Florczyk
Gentoo/NetBSD development lead
Back to top
View user's profile Send private message
Craig_Williamson
n00b
n00b


Joined: 04 Mar 2003
Posts: 65
Location: New Zealand

PostPosted: Fri Sep 12, 2003 10:24 am    Post subject: Reply with quote

Thanks, but I have already tried that.

I'll try emerging the latest ebuild and see if that fixes it.
Back to top
View user's profile Send private message
Zuti
Tux's lil' helper
Tux's lil' helper


Joined: 09 Jul 2003
Posts: 123
Location: The Netherlands

PostPosted: Fri Sep 12, 2003 10:52 am    Post subject: Reply with quote

I have the same problem as Craig.

I emerged mysql, did an etc-update but I get this:
Code:
bash-2.05b# /etc/init.d/mysql start
/sbin/runscript.sh: line 18: [: /var/lib/mysql: binary operator expected
 * Starting mysqld...                                                     [ ok ]


Then I do mysql_install_db
and I try to set the root password. This fails.
Code:
bash-2.05b# mysqladmin -u root password '12345'
or
bash-2.05b# mysqladmin -u root -h localhost password '12345'
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!


I then manually put my password in /etc/mysql/my.conf
But nothing seems to work.
Reemrging doesnt do it. When I try to stop mysql services i get this:
Code:
bash-2.05b# /etc/init.d/mysql stop
 * Stopping mysqld...                                                     [ !! ]
Back to top
View user's profile Send private message
Craig_Williamson
n00b
n00b


Joined: 04 Mar 2003
Posts: 65
Location: New Zealand

PostPosted: Fri Sep 12, 2003 9:15 pm    Post subject: Reply with quote

Hi Zuti,

That's the problem I'm getting. There must be something else we're missing.

I have checked the ebuild and it mentions the mysqld.sock in there.

Quote:

econf \
--libexecdir=/usr/sbin \
--sysconfdir=/etc/mysql \
--localstatedir=/var/lib/mysql \
--with-raid \
--with-low-memory \
--enable-assembler \
--with-charset=latin1 \
--enable-local-infile \
--with-mysqld-user=mysql \
--with-extra-charsets=all \
--enable-thread-safe-client \
--with-client-ldflags=-lstdc++ \
--with-comment="Gentoo Linux ${PF}" \
--with-unix-socket-path=/var/run/mysqld/mysqld.sock \
--with-embedded-server \
${myconf} || die "bad ./configure"

emake || die "compile problem"


Do we have to do something in /etc/group to get the thing working or should it just work?
Back to top
View user's profile Send private message
Craig_Williamson
n00b
n00b


Joined: 04 Mar 2003
Posts: 65
Location: New Zealand

PostPosted: Sat Sep 13, 2003 12:13 am    Post subject: Reply with quote

Hi There,

Here is the contents of the mysql file in the /etc/init.d directory. Could something be missing in here?

Quote:

#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /home/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-4.0.rc6,v 1.5 2003/04/22 10:00:18 robbat2 Exp $

depend() {
need net
use dns
}

checkconfig() {
if [ ! -f /etc/mysql/my.cnf ] ; then
eerror "No /etc/mysql/my.cnf file exists!"
fi

dir=`my_print_defaults mysqld | grep -- --datadir | sed -e "s|^.*=\(.*\)|\1|"`

if [ ! -d $dir/mysql ] ; then
eerror "You dont appear to have the mysql database installed yet."
eerror "Please run /usr/bin/mysql_install_db to have this done..."
return 1
fi
}

start() {
checkconfig || return 1
ebegin "Starting mysqld"
start-stop-daemon --start --quiet --exec /usr/bin/mysqld_safe \
--background -- >/dev/null 2>&1
eend $?
}

stop () {
ebegin "Stopping mysqld"
start-stop-daemon --stop --quiet --pidfile=/var/run/mysqld/mysqld.pid
eend $?
}
Back to top
View user's profile Send private message
Zuti
Tux's lil' helper
Tux's lil' helper


Joined: 09 Jul 2003
Posts: 123
Location: The Netherlands

PostPosted: Sat Sep 13, 2003 10:52 am    Post subject: Reply with quote

I did some emerging mysql too
First only mysql 4 (after deleting every trace of prevouis mysql merges)
The emerging mysql 3 and upgrading it to 4 (and yes i did an 'etc-update')
I checked permissions on my folders. Its all mysql:mysql.

mysql_install_db makes mysql and test db
It should also make a mysql.pid and a socket related thingy. But this does not happen.
BTW I'm using an Amd XP gentoo build and my gcc flags are not agressive (-O2).

/etc/init.d/mysql start says mysql started ok
but i cant stop mysql

I will compile mysql from source to see if the problem is related to me and my cpu or something or to ebuild.
Back to top
View user's profile Send private message
Zuti
Tux's lil' helper
Tux's lil' helper


Joined: 09 Jul 2003
Posts: 123
Location: The Netherlands

PostPosted: Sun Sep 14, 2003 1:17 pm    Post subject: Reply with quote

Ok, mysql (version 4.0.13-r4) works now, BUT on my gentoo stable (i have 2 gentoo's installed).
I didnt do anything spectacular.
Code:
emerge mysql
mysql_install_db
/etc/init.d/mysql start
mysqladmin -u root password 'password'


Thats it

I cant seem to install the latest mysql on my unstable gentoo (arch=~x86) and i dont have a clue why.
Back to top
View user's profile Send private message
dAIvd
n00b
n00b


Joined: 14 Sep 2003
Posts: 16

PostPosted: Sun Sep 14, 2003 5:24 pm    Post subject: I had the same problem Reply with quote

I emerged mySQL this week and could not get it to work.

/etc/init.d/mysqld start
said OK, but the daemon never started, so I had to 'mysqld zap' it and try again and again.

Finally I found that
/var/lib/mysql
had the wrong permissions set.

Now mysqld started, but I could still not connect or change the password. Then I found out the embarrasingly simple solution. I had to run
mysql -u root -p
or
mysqladmin -u root -p
and just give a blank password. :oops:

Not "my_password" as given in /etc/mysql/my.cnf. The shell commands that mysql_install_db suggests to change the password did not work for me either, I had to log in with a blank password first.

Hope this helped someone... :wink:
Back to top
View user's profile Send private message
Craig_Williamson
n00b
n00b


Joined: 04 Mar 2003
Posts: 65
Location: New Zealand

PostPosted: Mon Sep 15, 2003 12:16 am    Post subject: Reply with quote

What permissions did you change it to?

I changed the folder permissions of /var/lib/mysql and /var/run/mysql to:

File Owner: root
File Group: users

and it still wouldn't work.
Back to top
View user's profile Send private message
lorenb
Apprentice
Apprentice


Joined: 24 Aug 2002
Posts: 207
Location: Toronto, ON

PostPosted: Mon Sep 15, 2003 8:36 pm    Post subject: Reply with quote

Craig_Williamson wrote:
What permissions did you change it to?

I changed the folder permissions of /var/lib/mysql and /var/run/mysql to:

File Owner: root
File Group: users

and it still wouldn't work.


I just saw this thread and I got it working by chaing the permissions of /var/lib/mysql/mysql.

The problem was that /var/lib/mysql/mysql was owned by mysql:root but inside the files were all root:root. Once I changed it to mysql:root it worked fine and the daemon would start.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum