How to setup mysql on porteus?

Post here if you are a new Porteus member and you're looking for some help.
WavyLinesAreNotReal
White ninja
White ninja
Posts: 21
Joined: 08 Jan 2013, 05:07
Distribution: Porteus v3.1 KDE 64-bit
Location: USA

How to setup mysql on porteus?

Post#1 by WavyLinesAreNotReal » 08 Jan 2013, 05:33

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.

User avatar
Hamza
Warlord
Warlord
Posts: 1908
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: How to setup mysql on porteus?

Post#2 by Hamza » 08 Jan 2013, 07:50

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!
NjVFQzY2Rg==

WavyLinesAreNotReal
White ninja
White ninja
Posts: 21
Joined: 08 Jan 2013, 05:07
Distribution: Porteus v3.1 KDE 64-bit
Location: USA

Re: How to setup mysql on porteus?

Post#3 by WavyLinesAreNotReal » 08 Jan 2013, 17:43

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)

User avatar
Hamza
Warlord
Warlord
Posts: 1908
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: How to setup mysql on porteus?

Post#4 by Hamza » 08 Jan 2013, 17:50

Does this command helps you?

Code: Select all

touch /var/run/mysql/mysql.sock
NjVFQzY2Rg==

WavyLinesAreNotReal
White ninja
White ninja
Posts: 21
Joined: 08 Jan 2013, 05:07
Distribution: Porteus v3.1 KDE 64-bit
Location: USA

Re: How to setup mysql on porteus?

Post#5 by WavyLinesAreNotReal » 08 Jan 2013, 17:59

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).

User avatar
Hamza
Warlord
Warlord
Posts: 1908
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: How to setup mysql on porteus?

Post#6 by Hamza » 08 Jan 2013, 18:01

Restart the mysql server according to my previous post.
NjVFQzY2Rg==

WavyLinesAreNotReal
White ninja
White ninja
Posts: 21
Joined: 08 Jan 2013, 05:07
Distribution: Porteus v3.1 KDE 64-bit
Location: USA

Re: How to setup mysql on porteus?

Post#7 by WavyLinesAreNotReal » 08 Jan 2013, 18:10

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)

User avatar
wread
Module Guard
Module Guard
Posts: 1256
Joined: 09 Jan 2011, 18:48
Distribution: Porteus v5.0-kde-64 bits
Location: Santo Domingo
Contact:

Re: How to setup mysql on porteus?

Post#8 by wread » 08 Jan 2013, 19:16

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!
Porteus is proud of the FASTEST KDE ever made.....(take akonadi, nepomuk and soprano out and you will have a decent OS).
The Porteus Community never sleeps!

User avatar
Hamza
Warlord
Warlord
Posts: 1908
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: How to setup mysql on porteus?

Post#9 by Hamza » 08 Jan 2013, 19:26

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!
NjVFQzY2Rg==

WavyLinesAreNotReal
White ninja
White ninja
Posts: 21
Joined: 08 Jan 2013, 05:07
Distribution: Porteus v3.1 KDE 64-bit
Location: USA

Re: How to setup mysql on porteus?

Post#10 by WavyLinesAreNotReal » 08 Jan 2013, 21:02

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.

User avatar
Hamza
Warlord
Warlord
Posts: 1908
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: How to setup mysql on porteus?

Post#11 by Hamza » 08 Jan 2013, 21:31

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.
NjVFQzY2Rg==

User avatar
wread
Module Guard
Module Guard
Posts: 1256
Joined: 09 Jan 2011, 18:48
Distribution: Porteus v5.0-kde-64 bits
Location: Santo Domingo
Contact:

Re: How to setup mysql on porteus?

Post#12 by wread » 08 Jan 2013, 23:07

Are you using a 64-bit machine? if yes, you will need the 64-bit version of mysql..
Porteus is proud of the FASTEST KDE ever made.....(take akonadi, nepomuk and soprano out and you will have a decent OS).
The Porteus Community never sleeps!

cttan
Shogun
Shogun
Posts: 333
Joined: 26 Jan 2011, 16:15
Distribution: Porteus 3.2 and 4.0 64bit KDE
Location: Malaysia

Re: How to setup mysql on porteus?

Post#13 by cttan » 09 Jan 2013, 22:16

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

User avatar
Hamza
Warlord
Warlord
Posts: 1908
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: How to setup mysql on porteus?

Post#14 by Hamza » 09 Jan 2013, 22:40

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".
NjVFQzY2Rg==

Post Reply