Page 1 of 1

[Solved] MySQL

Posted: 18. Jan 2010, 15:48
by scheelga
Hello All,

I am new to Salix and slackware. I've installed MySQL and checked the box for mysqld in the 'Startup Services' dialog. However, it does not appear to be starting:

Code: Select all

glen[~]$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
Any ideas?

Re: MySQL

Posted: 18. Jan 2010, 16:24
by thenktor
Run the following to make the mysql start script executable:
chmod +x /etc/rc.d/rc.mysql

You also have to change ownership for the database:
chown -R mysql:mysql /var/lib/mysql

After that start mysql with:
/etc/rc.d/rc.mysql start

Then you are ready to initilize your mysql database with the usual tools.

Re: MySQL

Posted: 18. Jan 2010, 16:42
by damNageHack
thenktor, you are absolutely right.

But you should know the "service" command and make some advertisement for it ... Shame on you :oops: :roll:
man service wrote: NAME
service - a command line tool that helps with management of system ser‐
vices
(...)
service is part of the salixtools package.
(...)
AUTHORS
· George Vlahavas <vlahavas~at~gmail~dot~com>

service started as a fork of the service script originally written by:

· Jean-Philippe Guillemin <jp.guillemin~at~free~dot~fr>
It makes the job more easy (get root rights for it):

Code: Select all

# chown -R mysql:mysql /var/lib/mysql
# service restart mysql
Maybe a "service start" only will do the trick also.

But the user wrote he did check the box for mysql service to start, then it was maybe only the file rights problem.

Sorry, no problem. Only wanted to add this because the tool is great and some help towards more usability :lol:

Re: MySQL

Posted: 18. Jan 2010, 17:56
by scheelga
I've tried both methods and it seems to start and then immediately stop.

Code: Select all

root[glen]# chmod +x /etc/rc.d/rc.mysqld
root[glen]# chown -R mysql:mysql /var/lib/mysql
root[glen]# /etc/rc.d/rc.mysqld start
root[glen]# nohup: redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysql/mysql.pid
100118 09:51:09  mysqld ended

Code: Select all

root[glen]# service start mysqld
Starting the mysqld service
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysql/mysql.pid
100118 09:52:08  mysqld ended
Thanks for your help so far.

Re: MySQL

Posted: 18. Jan 2010, 18:01
by damNageHack

Code: Select all

100118 09:52:08  mysqld ended
I asked google for "100118 mysqld" and got this bug report:
http://bugs.mysql.com/bug.php?id=50419

Maybe check your logs if you have the same messages.

Re: MySQL

Posted: 18. Jan 2010, 20:34
by jpg153
Hi,

what is this
pid file /var/run/mysql/mysql.pid
file for?

Is it causing to stop the engine? Why is it there and what is its original purpose?

Re: MySQL

Posted: 18. Jan 2010, 23:09
by Shador
Try: rm -f /var/run/mysql/mysql.pid
And then start mysql.

Otherwise can you run (and post the complete output):

Code: Select all

bash -x /etc/rc.d/rc.mysqld start

Re: MySQL

Posted: 18. Jan 2010, 23:16
by thenktor
Did you initialize your database?

Re: MySQL

Posted: 19. Jan 2010, 01:30
by scheelga
No, I had not initialized it and that was part of the problem. I found an error log in /var/lib/mysql and googling the last error before the server shutdown led me to the MySQL forum and it turned out that the solution was:

Code: Select all

rm -rf /var/lib/mysql
cd /usr/lib
./mysql_install_db --user=mysql --ldata=/var/lib/mysql 
chown -R mysql:mysql /var/lib/mysql
/etc/rc.d/rc.mysqld start


Thanks to all for the suggestions.

Re: [Solved] MySQL

Posted: 19. Jan 2010, 08:59
by JRD
All this is explained in /usr/doc/mysql !