# [SOLVED] Mysql only runs as root

## jamesshuang

Ok, so here's the problem. I have mysql running properly. When I am the root user, connecting to the server is simple- mysql -u root -p connects properly. However, if I am any other user, typing that same statement gives me an error- "Could not connect to socket /var/run/mysql/whatever (13)". The problem that arises is, php can't connect to mysql now, because it runs under the user "apache", not root. This is a brand new install of gentoo, and I've tried so many combinations of mod_php/apache/mysql that I've lost count. Currently, I'm running mysql 4.1, mod_php 5.0.4, and the latest apache. Any hints on getting this running?Last edited by jamesshuang on Sun Jun 12, 2005 5:44 pm; edited 1 time in total

----------

## zonk

have you tried adding the necessary user to the mysql group?

----------

## jamesshuang

I've added both my normal user and apache to the mysql group, but still no luck. The exact error message when I try to log on with any other user is 

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)

Any other ideas?

----------

## jamesshuang

Actually... I forgot to log out and log back in... It seems to be working fine now... Thank you!

----------

## OgRo

damnit!

I am having the very same problem, but adding the user to mysql grou did not solved.

I can't find anything relevant on the logs, I do can login as root when I am using the root user but I cannot login as a regular system user even if it is in the mysql group.

any tips?

----------

## matttions

Some problem here....

only root can access to mysql ..

anyone else would be refused ...

just try to add apache to mysql group.. and pray ...

Edit ---

not working at all ... 

another idea ? ...

----------

## KCh1

I have the same problem

only root can access to mysql ..

not working at all ...

----------

## soldstatic

somewhat related:

where does one go to configure the mysql stuff??

what about isntalling phpmyadmin? Can we just emerge it and nav to it? or... ?

I'm getting the same error, but I don't know where to go to configure the stuff for the mysql.... 

<-- noop

----------

## Macheath

I just figured it all out and installed mysql, apache2 and cakephp myself.

Mysql was set to use /var/run/mysqld/mysqld.sock as socket. I needed to add apache to the mysql group 

```
gpasswd -a apache mysql
```

Did the same thing for the user that wants to run mysql.

I then had to set ownership of /var/run/mysqld to 'mysql' group: 

```
chown mysql:mysql /var/run/mysqld
```

.

Now it all works, but don't forget to restart apache2 

```
/etc/init.d/apache2 restart
```

 and log out and back in again.

----------

