Page 1 of 1

How to setup mysql on porteus?

Posted: 08 Jan 2013, 05:33
by WavyLinesAreNotReal
After downloading mysql (with dependencies) and activating the module, I get this error message after typing in "mysql -u root -p":

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

I'm not too familiar with how to set up mysql on porteus, but any help is appreciated.

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 07:50
by Hamza
Easy to solve !

Executes these commands in a changes-saved environment (as root):
  1. Making executable the mysql run script

    Code: Select all

    chmod +x /etc/rc.d/rc.mysqld
  2. Executing the mysql run script in order to run mysql

    Code: Select all

    /etc/rc.d/rc.mysqld start
Enjoy!

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 17:43
by WavyLinesAreNotReal
I executed the commands:

Code: Select all

>chmod +x /etc/rc.d/rc.mysqld
>/etc/rc.d/rc.mysqld start
and got the following output:

Code: Select all

130108 12:25:50 mysqld_safe Logging to '/var/lib/mysql/porteus.err'.
130108 12:25:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130108 12:25:51 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended
So I'm guessing its good up to that point.
However, when I login as root (no password by default) I'm still getting the same error:

Code: Select all

>mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 17:50
by Hamza
Does this command helps you?

Code: Select all

touch /var/run/mysql/mysql.sock

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 17:59
by WavyLinesAreNotReal
I noticed the error message is a little different this time:

Code: Select all

>touch /var/run/mysql/mysql.sock
>mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (111)
At the end of the output, the (2) is now a (111).

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 18:01
by Hamza
Restart the mysql server according to my previous post.

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 18:10
by WavyLinesAreNotReal
Same outcome:

Code: Select all

>chmod +x /etc/rc.d/rc.mysqld
>/etc/rc.d/rc.mysqld start
130108 13:04:04 mysqld_safe Logging to '/var/lib/mysql/porteus.err'.
130108 13:04:04 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130108 13:04:07 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended
>touch /var/run/mysql/mysql.sock
>mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (111)

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 19:16
by wread
I had this problem once and solved it. It is in this post:
http://forum.porteus.org/viewtopic.php? ... ysql#p6136

Try it, it worked for me!

Regards!

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 19:26
by Hamza
The problem is simple to solve. I had forgot this little detail as i'm usually running mysql on another distribution than Porteus.

Do these steps:
  1. Open /etc/rc.d/rc.mysqld
  2. Search the line with "/usr/bin/mysqld_safe"
  3. Add just before "--datadir" (but can done at end of line too) argument this:

    Code: Select all

    --user=root
  4. You should have a begin of line like this

    Code: Select all

    /usr/bin/mysqld_safe --user=root --datadir=/var/lib/mysql
Thanks!

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 21:02
by WavyLinesAreNotReal
I've applied all suggestions thus far, but with no success. I'll explain exactly what I've done.

This file:

Code: Select all

/etc/rc.d/rc.mysqld
has been editted with this line of code:

Code: Select all

/usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid $SKIP &
changed to:

Code: Select all

/usr/bin/mysqld_safe --user=root --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid $SKIP &

Using this module:

Code: Select all

mysql-5.0.67-i486-1.xzm
which was converted from slackware, I get the following output upon following these instructions:

Code: Select all

>chmod +x /etc/rc.d/rc.mysqld
>/etc/rc.d/rc.mysqld start
nohup: redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysql/mysql.pid
130108 15:33:28  mysqld ended

>touch /var/run/mysql/mysql.sock
>mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (111)
Using this module:

Code: Select all

mysql-5.1.46.xzm
which was downloaded from the link supplied by wread, I get the following output from these instructions:

Code: Select all

>chmod +x /etc/rc.d/rc.mysqld
>/etc/rc.d/rc.mysqld start
130108 15:42:23 mysqld_safe Logging to '/var/lib/mysql/porteus.err'.
130108 15:42:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130108 15:42:24 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended

>touch /var/run/mysql/mysql.sock
>mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (111)
And finally, using this module:

Code: Select all

mysql-5.1.56-i486-1.xzm
which was downloaded from the official porteus repository, I get this output:

Code: Select all

>chmod +x /etc/rc.d/rc.mysqld
>/etc/rc.d/rc.mysqld start
130108 15:47:17 mysqld_safe Logging to '/var/lib/mysql/porteus.err'.
130108 15:47:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130108 15:47:17 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended

>touch /var/run/mysql/mysql.sock
>mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (111)
Note that in each case the mysql modules were not allowed to run at the same time.
So it doesn't seem that changing the module nor the instructions thus far fixes the issue, as I still get:

Code: Select all

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (111)
as the final outcome.

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 21:31
by Hamza
This working fine here. Tested 3 times with fresh vanilla ISO of Porteus and mysql from slackyd.

You must have missed something or mixed some instructions.

Re: How to setup mysql on porteus?

Posted: 08 Jan 2013, 23:07
by wread
Are you using a 64-bit machine? if yes, you will need the 64-bit version of mysql..

Re: How to setup mysql on porteus?

Posted: 09 Jan 2013, 22:16
by cttan
Hi WavyLinesAreNotReal,

Try these steps:-

chown -R mysql:mysql /var/lib/mysql
chown -R mysql:mysql /var/run/mysql

and then start
/etc/rc.d/rc.mysqld start

Re: How to setup mysql on porteus?

Posted: 09 Jan 2013, 22:40
by Hamza
Interesting, it may also works with these fixes as it doesn't need to executes from root. The problem is that the mysqld is executed from root and by design mysql doesn't allow to be ran by root for security reasons expect if you force it by using "--user=root".