473,327 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Connecting to mysql

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
4 2009
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
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
3
by: kamilla | last post by:
I have a mysql 3.5 server installed on a suse linux 8.1, with address 10.0.0.100. Now I want to access that db from a W2K pc, address 10.0.0.200. I am able to ping 10.0.0.100, but I cannot connect...
2
by: news | last post by:
We currently have our mySQL server on the same box as the Apache server. For security and load balancing, we're going to be moving the mySQL server to another box. We're already using a single...
4
by: CodeImp | last post by:
A simple app I quickly wrote to try getting info from a database. Here is the first part of its code. The rest of the code is irellevant. using System; using System.Data; using...
4
by: sympatico | last post by:
Hello Im seeking some code or way to connect VB.NET application with MySQL database. There are some softwares available which are very expensive. So anyone who knows to connect without a...
3
by: Jeremy Dillinger | last post by:
I am trying to design a program that will use data from a MySQL database. Currently all the data is being used with PHP scripts from a website. I am also trying to build a software solution that...
7
by: Frances | last post by:
this seems pretty straight-forward.. got this code $link = mysql_connect('localhost:3306', '<uid>', '<pswd>'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected...
3
by: Paradox Synthesist | last post by:
hi, i am a newbie to asp.net and have started learning mainly from websites. i have a question which IS very silly and trivial. ...
5
by: Ananthu | last post by:
Hi I have done all the codings part for connecting mysql server with java application but when i try to compile,the compilation is successful and during execution i get the following message, ...
8
by: Ananthu | last post by:
Hi I have done all the codings part for connecting mysql with java in eclipse environment. Coding Part: import java.sql.Connection; import java.sql.DriverManager; public class...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.