Jump to content

Can't connect to mysql


pacman

Recommended Posts

I installed mysql and a groupware tool. Everything went fine until I tried to change some permissions to the database...

 

My problem:

 

The Groupware Tool is up and running fine - it\'s ok

But I can\'t connect to mysql with another user or with the mysqladmin...

 

Error message:

[root@localhost mysql]# mysql

ERROR 2002: Can\'t connect to local MySQL server through socket \'/var/lib/mysql/mysql.sock\' (111)

[root@localhost mysql]#

 

Mysql is running:

[root@localhost mysql]# ps -ef | grep mysql

root 941 1 0 Feb20 ? 00:00:00 /bin/sh /usr/bin/safe_mysqld --d

mysql 7391 941 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f

mysql 7393 7391 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f

mysql 7394 7393 0 Feb21 ? 00:00:01 /usr/libexec/mysqld --defaults-f

mysql 7395 7393 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f

root 17415 16950 0 17:12 pts/0 00:00:00 grep mysql

 

and the .sock file exists:

 

[root@localhost mysql]# ls -l /var/lib/mysql/mysql.sock

-rwxrwxrwx 1 mysql mysql 0 Feb 27 16:34 /var/lib/mysql/mysql.sock

[root@localhost mysql]#

 

If I try to connect via PHPmyAdmin I get the message

 

Server localhost

Error

 

MySQL said:

 

 

MySQL Connection Failed: Can\'t connect to local MySQL server through socket \'/var/lib/mysql/mysql.sock\' (111)

 

Maybe I have to explain how this situation was coming up...

 

I had the whole installation working with localhost permissons for access to mysql. I tried to change this via Webmin that I can access the DB from a Gui outside this host. I think I took all permissions from the super user (Don\'t know how :roll: ).

 

Is it possible to rebuild the user table? Without affect to the running Groupware?

 

Regards

Frank

Link to comment
Share on other sites

Ok, I did it, but I still get the message:

 

[root@localhost bin]# ./mysqladmin status

./mysqladmin: connect to server at \'localhost\' failed

error: \'Can\'t connect to local MySQL server through socket \'/var/lib/mysql/mysql.sock\' (111)\'

Check that mysqld is running and that the socket: \'/var/lib/mysql/mysql.sock\' exists!

[root@localhost bin]#

 

BUT MySQL is running:

 

[root@localhost bin]# ps -ef |grep mysql

root 941 1 0 Feb20 ? 00:00:00 /bin/sh /usr/bin/safe_mysqld --d

mysql 7391 941 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f

mysql 7393 7391 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f

mysql 7394 7393 0 Feb21 ? 00:00:01 /usr/libexec/mysqld --defaults-f

mysql 7395 7393 0 Feb21 ? 00:00:00 /usr/libexec/mysqld --defaults-f

root 18411 18342 0 10:16 pts/0 00:00:00 grep mysql

[root@localhost bin]#

Link to comment
Share on other sites

Hi, try the following and then log into phpmyadmin using the biopv user (or your own username - probably a better idea :) )

 

It\'s probably just the grant tables that needs updating...

 

P.

 


Shell>mysql -h localhost -u root  

Welcome to the MySQL monitor.  Commands end with; or g. 

Your MySQL connection id is 14 to server version: 3.23.52 



Type \'help;\' or \'h\' for help. Type \'c\' to clear the buffer. 



mysql> use mysql 

Reading table information for completion of table and column names 

You can turn off this feature to get a quicker startup with -A 



Database changed 

mysql> 

mysql> grant all privileges on *.* to biopv@"%" identified by \'biopv\' with grant option; 

Query OK, 0 rows affected (0.00 sec) 



mysql> 

mysql> 

mysql> grant all privileges on *.* to biopv@localhost identified by \'biopv\' with grant option; 

Query OK, 0 rows affected (0.00 sec) 



Link to comment
Share on other sites

Hi,

 

this is really help for dummies, thanks :-)

 

But:

 


[root@localhost /root]# mysql -h localhost -u root  

Welcome to the MySQL monitor.  Commands end with; or g.

Your MySQL connection id is 68 to server version: 3.23.36



Type \'help;\' or \'h\' for help. Type \'c\' to clear the buffer



mysql> use mysql 

ERROR 1044: Access denied for user: \'@localhost\' to database \'mysql\'

mysql> 

 

 

I think the user root doesn\'t exist?

 

Frank

Link to comment
Share on other sites

Hmmm.....

 

You ran the mysql_install_db program and something went wrong ?

 

You should probably back up your data before continuing with anything. Just make a copy of the mysql/var/data or whereever they are stored... (You databases are put in a folder of their own with the database name as folder name).

 

It looks like you could successfully login as root with a blank password, but you do not have permission to use the mysql database ?

 

I\'m not sure if there is a clever solution (probably there is)... otherwise reinstall and then copy the databases you need back (don\'t restore the mysql database, since that\'s most likely what\'s causing the problem).

 

My suggestion:

 

Find the directory where you can see the folders named

 

test

mysql

yourdb (whatever dbs you created).

 

DELETE the mysql folder (i.e. the user tables, grant tables etc.)

 

Run mysql_install_db again

 

Check to see that a new folder has been generated, with new users etc...

 

If this doesn\'t work - I\'m lost.... But as I said, BACKUP first!

 

P.

Link to comment
Share on other sites

  • 7 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.