View previous topic :: View next topic |
Author |
Message |
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Thu Jan 27, 2005 6:27 pm Post subject: MySQL installation problems |
|
|
Hello fellow gentooists,
I am trying to install MySQL on my server, I use this wiki as a guide:
http://gentoo-wiki.com/HOWTO_Apache2_with_PHP_MySQL
After I have emerged MySQL, I use the following command to install the database:
Code: | /usr/bin/mysql_install_db |
No error messages are shown.
Next I do:
Code: | bash-2.05b# /etc/init.d/mysql start
* Starting mysqld... [ ok ] |
The problem shows up with the next command:
Code: | bash-2.05b# /usr/bin/mysql -u root
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) |
/var/run/mysqld is empty
I have searched the Gentoo forum thouroughly. I tried different approaches discribed in various solutions, which did not work for me.
I also used the following command instead of the mysql_install_db script.
Code: | ebuild /var/db/pkg/dev-db/mysql.*/mysql.*.ebuild config |
Any thoughts? |
|
Back to top |
|
|
expat_iain Guru
Joined: 09 Jan 2004 Posts: 361 Location: Malta GC
|
Posted: Thu Jan 27, 2005 6:51 pm Post subject: |
|
|
One springs to mind, su to the user that mysqld runs as. Then try to cd into the directory where the socket file is created and touch <filename>.
I'm guessing there's a permissions issue with the mysqld user creating that file.
Regs.
Iain. |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Thu Jan 27, 2005 7:15 pm Post subject: |
|
|
Thanks for the quick reply.
As I said the /var/run/mysqld folder is empty, so there is not much te be touched... |
|
Back to top |
|
|
dashnu l33t
Joined: 21 Jul 2004 Posts: 703 Location: Casco Maine
|
Posted: Thu Jan 27, 2005 7:33 pm Post subject: |
|
|
who owns /var/run/mysqld ?
should look like this
Code: | drwxr-xr-x 2 mysql mysql 4096 Jan 24 12:57 mysqld |
Code: | chown mysql:mysql /var/run/mysqld |
than start mysql _________________ write quit bang |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Thu Jan 27, 2005 8:09 pm Post subject: |
|
|
User and group of /var/run/mysqld are already set to mysql. |
|
Back to top |
|
|
dashnu l33t
Joined: 21 Jul 2004 Posts: 703 Location: Casco Maine
|
Posted: Thu Jan 27, 2005 8:26 pm Post subject: |
|
|
try ?
Code: | mysql -u root -p mysql |
_________________ write quit bang |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Fri Jan 28, 2005 5:33 pm Post subject: |
|
|
As root:
Code: | bash-2.05b# mysql -u root -p mysql
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) |
|
|
Back to top |
|
|
expat_iain Guru
Joined: 09 Jan 2004 Posts: 361 Location: Malta GC
|
Posted: Fri Jan 28, 2005 6:48 pm Post subject: |
|
|
Myth|384 wrote: | As I said the /var/run/mysqld folder is empty, so there is not much te be touched... |
Okay, but if you cannot cd into that directory from / as the mysqld user, then the sock file will not be created. Can you start mpsqld from shell as root and connect okay?? That's one thing to try that the server will start. Next up, can you try and touch a file (any name) into /var/run/mysqld as the mysql user. If it's done and it works, at least we can cross that one off the list. Very often it's these sorts of things that hold the problem!
Regs.
Iain. |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Mon Jan 31, 2005 5:31 pm Post subject: |
|
|
As root:
Code: | bash-2.05b# /etc/init.d/mysql start
* Starting mysqld... [ ok ] |
Code: | bash-2.05b# ps a | grep mysql
12395 pts/1 S+ 0:00 grep mysql
|
So it looks like MySQL isn't running at all... |
|
Back to top |
|
|
PhragMunkee n00b
Joined: 01 Feb 2005 Posts: 6
|
Posted: Tue Feb 01, 2005 6:39 am Post subject: |
|
|
I'm getting the same errors--no socket errors and no instances of mysqld running in ps -ax. I'm sure our issues are related. No amount of my.cnf files and mysqld_safe --datadir=/var/lib/mysql seem to work.
One clue is from the /var/log/mysqld.err file:
Code: | 050201 1:24:04 /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
050201 1:24:04 Fatal error: Can't open privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
050201 1:24:04 Aborting
050201 1:24:04 /usr/sbin/mysqld: Shutdown Complete |
This appears several times over and over again (from failed attempts to start). However, that directory and those .frm files exist!
Code: | root@www mysql # ls -l /var/lib/mysql/mysql
total 66
-rw-rw---- 1 mysql mysql 0 Jan 27 14:50 columns_priv.MYD
-rw-rw---- 1 mysql mysql 1024 Jan 27 14:50 columns_priv.MYI
-rw-rw---- 1 mysql mysql 8778 Jan 27 14:50 columns_priv.frm
-rw-rw---- 1 mysql mysql 306 Jan 27 14:50 db.MYD
-rw-rw---- 1 mysql mysql 3072 Jan 27 14:50 db.MYI
-rw-rw---- 1 mysql mysql 9088 Jan 27 14:50 db.frm
-rw-rw---- 1 mysql mysql 0 Jan 27 14:50 func.MYD
-rw-rw---- 1 mysql mysql 1024 Jan 27 14:50 func.MYI
-rw-rw---- 1 mysql mysql 8641 Jan 27 14:50 func.frm
-rw-rw---- 1 mysql mysql 0 Jan 27 14:50 host.MYD
-rw-rw---- 1 mysql mysql 1024 Jan 27 14:50 host.MYI
-rw-rw---- 1 mysql mysql 9064 Jan 27 14:50 host.frm
-rw-rw---- 1 mysql mysql 0 Jan 27 14:50 tables_priv.MYD
-rw-rw---- 1 mysql mysql 1024 Jan 27 14:50 tables_priv.MYI
-rw-rw---- 1 mysql mysql 8877 Jan 27 14:50 tables_priv.frm
-rw-rw---- 1 mysql mysql 240 Jan 31 02:56 user.MYD
-rw-rw---- 1 mysql mysql 2048 Jan 31 02:57 user.MYI
-rw-rw---- 1 mysql mysql 9806 Jan 27 14:50 user.frm |
Oh, and before I forget, a "uname -a" returns
Code: | root@www mysql # uname -a
Linux www 2.6.8.1-co-0.6.2-pre6 #58 Sun Oct 24 21:48:46 IST 2004 i686 AMD Athlon(tm) XP 3000+ AuthenticAMD GNU/Linux |
It's a coLinux install, but I don't believe that has much of anything to do with the errors as it does maybe the portage compile/fubared scripts?
An "emerge dev-db/mysql --pretend --verbose" returns:
Code: | root@www mysql # emerge dev-db/mysql --pretend --verbose
These are the packages that I would merge, in order:
Calculating dependencies ...done!
[ebuild R ] dev-db/mysql-4.0.22-r2 +berkdb -debug -innodb +perl +readline (-selinux) +ssl -static +tcpd 0 kB
Total size of downloads: 0 kB |
The 0 kB is because it's already been downloaded and attempted to compile/install.
I've worked on this for two nights now and haven't made any progress (even tried unmerging and re-merging). |
|
Back to top |
|
|
kashani Advocate
Joined: 02 Sep 2002 Posts: 2032 Location: San Francisco
|
Posted: Tue Feb 01, 2005 6:51 am Post subject: |
|
|
I'd do the following
Code: |
/etc/init.d/mysql stop
/etc/init.d/mysql zap
emerge -C mysql
rm -rf /var/lib/mysql
rm /etc/mysql/my.conf
rm /var/run/mysql/*
emerge mysql
|
Ideally things would be pretty clean at this point.
Code: |
azul root # /etc/init.d/mysql start
* You don't appear to have the mysql database installed yet.
* Please run /usr/bin/mysql_install_db to have this done...
|
so far so good
Code: |
azul root # /usr/bin/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/etc/init.d/mysql start (you have to start the server first!)
/usr/bin/mysqladmin -u root -h azul password 'new-password'
/usr/bin/mysqladmin -u root password 'new-password'
|
now to set the password using the last line as because be default mysql does not run on the hostname's IP, only localhost.
Code: |
azul root # /etc/init.d/mysql start
* Starting mysqld... [ ok ]
azul root # /usr/bin/mysqladmin -u root password 'db-passwd'
azul root # mysql -u root -pdb-passwd
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.0.22
|
Hopefully that works and you're all set.
kashani _________________ Will personally fix your server in exchange for motorcycle related shop tools in good shape. |
|
Back to top |
|
|
PhragMunkee n00b
Joined: 01 Feb 2005 Posts: 6
|
Posted: Tue Feb 01, 2005 3:41 pm Post subject: |
|
|
That seemed to do the trick! The only thing you suggested differently was:
Code: | rm -rf /var/lib/mysql
rm /etc/mysql/my.conf
rm /var/run/mysql/* |
Very much appreciated! I hope it also helps out with Myth|384!
Thanks again! |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Wed Feb 02, 2005 4:43 pm Post subject: |
|
|
Hmmm, doesn't work for me...
All goes well until:
Code: | bash-2.05b# /usr/bin/mysqladmin -u root password 'myPassword'
/usr/bin/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 will try it one more time... |
|
Back to top |
|
|
kashani Advocate
Joined: 02 Sep 2002 Posts: 2032 Location: San Francisco
|
Posted: Wed Feb 02, 2005 7:59 pm Post subject: |
|
|
I'd guess that mysql isn't running.
1. check your system logs
2. check your mysql logs
3. think about your cflags. Mysql can be very sensitive to how you built it.
kashani _________________ Will personally fix your server in exchange for motorcycle related shop tools in good shape. |
|
Back to top |
|
|
Dwin n00b
Joined: 18 Sep 2004 Posts: 68
|
Posted: Wed Feb 02, 2005 9:52 pm Post subject: |
|
|
Mmmmh, I am not a specialist but, is your loopback correctly configured ?
Do you have some firewall that could block the port 3306 ?
What's the value of the parameter bind-address in your /etc/mysql/my.cnf ? |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Mon Feb 07, 2005 10:04 pm Post subject: |
|
|
...
Last edited by Myth|384 on Wed Feb 09, 2005 1:03 pm; edited 1 time in total |
|
Back to top |
|
|
gnostek n00b
Joined: 06 Nov 2004 Posts: 7
|
Posted: Tue Feb 08, 2005 6:25 am Post subject: mySQL is broken now... |
|
|
OK, I installed mySQL-4.0.22-r2 during my installation of slashcode, and everything worked perfectly. Slash was broken though , tried reinstalling slash... complained about DBI. Decided to reinstall mySQL, and have received
Code: | root@gnosys gnostek # /usr/bin/mysqladmin -u root password 'mypassword'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server though socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket' '/var/run/mysqld/mysqld.sock' exists!
root@gnosys gnostek # /usr/bin/mysqladmin -u root -h gnosys password 'mypassword'
/usr/bin/mysqladmin: connect to server at 'gnosys' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)' |
ever since. I have tried several variations on kashani's fix, and am still getting the same set of error messages i'm going to hunt through log files now... any further suggestions? |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Wed Feb 09, 2005 1:04 pm Post subject: |
|
|
...
Last edited by Myth|384 on Thu Feb 10, 2005 11:09 am; edited 1 time in total |
|
Back to top |
|
|
gnostek n00b
Joined: 06 Nov 2004 Posts: 7
|
Posted: Thu Feb 10, 2005 10:38 am Post subject: Advice from IRC |
|
|
Code: | bash # killall mysqld
bash # rm /var/lib/init.d/started/mysql*
bash # /etc/init.d/mysql start
bash # mysql -u root | This fix from #gentoo-servers gave me that glorious 'mysql>' prompt which I have been craving... hope it helps. Now, off to break it again.... |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Thu Feb 10, 2005 11:18 am Post subject: |
|
|
Ok, kashani, I got it almost working now. I followed your guide again, but instead of:
Code: | /usr/bin/mysql_install_db |
I have to do:
Code: | ebuild /var/db/pkg/dev-db/mysql-4.0.22-r2/mysql-4.0.22-r2.ebuild config |
Next:
Code: | bash-2.05b# /etc/init.d/mysql start
* Starting mysqld... [ ok ]
bash-2.05b# /usr/bin/mysqladmin -u root password 'db-passwd'
bash-2.05b# mysql -u root -p |
Filling in the correct password gives a mysql> prompt.
Checking if processes are running:
Code: | bash-2.05b# ps -A | grep mysql
7540 ? 00:00:00 mysqld_safe
7576 ? 00:00:00 mysqld
7577 ? 00:00:00 mysqld
7578 ? 00:00:00 mysqld
7579 ? 00:00:00 mysqld |
Looks fine to me.
Pid and sock files are both created:
Code: | bash-2.05b# ls /var/run/mysqld
mysqld.pid mysqld.sock |
After I add mysql to the default or boot run level, I reboot the system and try to start mysql again;
Code: | bash-2.05b# mysql -u root -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) |
Man what a troubles...
(Sorry for reposting this message after gnostek's messages, but else it may look as if this subtject is solved.) |
|
Back to top |
|
|
stealthy Tux's lil' helper
Joined: 08 Aug 2002 Posts: 118 Location: ONTARIO CANADA
|
Posted: Sat Feb 12, 2005 4:10 pm Post subject: |
|
|
Ok just my two cents.
I had the exact same problem. I think it originally started or maybe not...
anyway I had the exact same errors.
but by doing
Code: | /etc/init.d/mysql zap |
and then restarting it by
Code: | /etc/init.d/mysql start |
fixed up everything...didn't have to re-emerge or anything
_________________ All your Gentoo are belong to us. |
|
Back to top |
|
|
Myth|384 n00b
Joined: 10 Aug 2004 Posts: 24
|
Posted: Sun Feb 13, 2005 10:44 am Post subject: |
|
|
No... That does not work for me.
Anyway, is it that hard to solve this problem? |
|
Back to top |
|
|
|