Mysql issue

I installed MySql via Yast in 10.3. After I start up the machine mysql isn’t running and when I try to start it I get this error: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

If I reinstall MySQL and set up the root password it works until I log back in.

I don’t really need it running every time I start my machine. How do I manually start it and if I want force it to run on boot? The Mysql entry on this site assumes that by installing through yast and setting the password means that all is well so there is no other information.

chkconfig mysql on
Starts it upon every reboot.

rcmysql start
Starts MySQL.

Both must be issued as either root or with super user privileges.

Thanks but neither of those worked. I found the solution: /sbin/service mysql start

Probably didn’t work because you didn’t have /sbin and /usr/sbin on your $PATH. su by itself won’t change $PATH, but if you do su -, you will get root’s $PATH and chrysantine’s suggestions will work. Or specify the absolute path:

/sbin/chkconfig
/usr/sbin/rcmysql

/etc/init.d/mysql start
works fine for me… i start as when I need…:slight_smile:

If they didn’t work, you weren’t root.

Use Yast to go into System Services and check mysql and apache and everything will be OK.

You shouldn’t try to run mysql from the Linux root at all as Apache is up and running and you will be vulnerable, only from user.

If you are worried about accidents while root, use sudo:

sudo /usr/sbin/rcmysql start

or

sudo /etc/init.d/mysql start

which is portable across Linuxes.

Much faster than firing up YaST and works over a terminal connection.

The init scripts switch user privileges - that’s why you’re supposed to use them :wink:

I was root and they didn’t work.not with su or with sudo. sudo doesn’t run many root programs, ifconfig and iwconfig to name two.

su - did work

We have learned today that su or sudo won’t run everything. Apparently su - will.

I don’t use Apache so no worries there. I only use MySQL to test a few rails apps running in mongrel.

Why in the heck are the mysql files scattered all over the file system and there are so many ways to start it? That is not indicative of good design. Mysql isn’t the only offender. The number of places that crap for java is scattered around is even worse.

The official way that works on all Linux systems because it’s a standard.

/etc/init.d/mysql start

The SUSE shortcut, very handy:

rcmysql start

If you look carefully, /usr/sbin/rcmysql is just a symlink to /etc/init.d/mysql.

The RedHat way, which I think is poorer than the SUSE way, because you can’t use file completion, copied by SUSE for making RedHat refugees feel at home. :slight_smile:

service mysql start

service is just a shell script juggles its arguments to give you effectively the first way.

If you don’t want to know all this, just remember the first way. :stuck_out_tongue: