By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,275 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Connecting to mysql

P: n/a
I am not able to connect to the mysql DB if I am not the root user. I
have already found identified an issue:

* mysql.sock is NOT located in /tmp

So, to get around it I created a sym link to the actual location
(/var/lib/mysql/mysql.sock). This file, and the sym link, are both
owned by root but they have full permission for all user. But the
parent directories are ONLY READ and EXECUTABLE for non root users.

If I change the permissions on:

* /var
* /var/lib
* /var/lib/mysql

I am able to connect to mysql (from both command line and my PHP
script). But I really don't want to leave it so open.

Any ideas how to get around this? I'm thinking the best solution would
be to make mysql create the .sock file in /tmp so that I don't have to
create the sym link. But I an open for any / all suggestions.

TIA.

- manzoor

Sep 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Manzoorul Hassan wrote:
I am able to connect to mysql (from both command line and my PHP
script). But I really don't want to leave it so open.


I have the sock file un /var/run/mysqld folder, but my permissions are
these:

/var/ drwxr-xr-x 15 root root
/var/lib/ drwxr-xr-x 42 root root
/var/lib/mysql drwxr-xr-x 20 mysql mysql

/var/run/ drwxr-xr-x 17 root root
/var/run/mysqld/ drwxr-xr-x 2 mysql root
/var/run/mysqld/mysqld.sock srwxrwxrwx 1 mysql mysql

Don't know if mysql.sock needs that much permissions, but at least the
/var, /var/run and /var/lib should be ownled and be writable my root
only. Note that even when only root can write to parent directories, you
can set other permissions to child directories, as I have.
One thing I don't understand is how do you people install the MySQL
server. I just run (Both on Ubuntu and on Debian)

apt-get update
apt-get install mysql-server

And it created the sock-file to correct place, set all permissions to
files etc. I didn't need to do anything for it. Are there still some
distros left that don't do this automatically?
Sep 15 '05 #2

P: n/a
Manzoorul Hassan wrote:
I am not able to connect to the mysql DB if I am not the root user. I
have already found identified an issue:

* mysql.sock is NOT located in /tmp


I would recommend either specifying the location of the socket file with
the "mysql -S" option (see
http://dev.mysql.com/doc/mysql/en/my...-options.html), or else
you can make an entry in the /etc/my.cnf to make client apps look for
the socket in another location (see example of [client] options in this
file at http://dev.mysql.com/doc/mysql/en/option-files.html).

You can also make the mysqld server create the socket in another
location like /tmp on startup, also using the option file.

Also see http://dev.mysql.com/doc/mysql/en/pr...ysql-sock.html

Regards,
Bill K.
Sep 15 '05 #3

P: n/a

Aggro wrote:
Manzoorul Hassan wrote:
I am able to connect to mysql (from both command line and my PHP
script). But I really don't want to leave it so open.
I have the sock file un /var/run/mysqld folder, but my permissions are
these:

/var/ drwxr-xr-x 15 root root
/var/lib/ drwxr-xr-x 42 root root
/var/lib/mysql drwxr-xr-x 20 mysql mysql

/var/run/ drwxr-xr-x 17 root root
/var/run/mysqld/ drwxr-xr-x 2 mysql root
/var/run/mysqld/mysqld.sock srwxrwxrwx 1 mysql mysql

Don't know if mysql.sock needs that much permissions, but at least the
/var, /var/run and /var/lib should be ownled and be writable my root
only. Note that even when only root can write to parent directories, you
can set other permissions to child directories, as I have.


thanx.

One thing I don't understand is how do you people install the MySQL
server. I just run (Both on Ubuntu and on Debian)

apt-get update
apt-get install mysql-server

And it created the sock-file to correct place, set all permissions to
files etc. I didn't need to do anything for it. Are there still some
distros left that don't do this automatically?


I am installing v4.1.14 (I got it at
http://dev.mysql.com/downloads/mysql/4.1.html) on Fedora Core 3
Installation. So I had to first run the configuraion, then "make" and
"make install".

- manzoor

Sep 16 '05 #4

P: n/a
Manzoorul Hassan wrote:
I am installing v4.1.14 (I got it at
http://dev.mysql.com/downloads/mysql/4.1.html) on Fedora Core 3
Installation. So I had to first run the configuraion, then "make" and
"make install".


Why don't you just use Fedora package manager to install it for you,
instead of downloading it and maintaining the upgrades manually? Or does
it now have version 4.1 which you need?
Sep 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.