Link to home
Create AccountLog in
Avatar of andieje
andieje

asked on

mysql installation all messed up

Hi

I'm trying to uninstall mysql but my machine says it isn't installed. When i look at the status of the mysql service it says it is running. When i try to access it I can't.

Any ideas welcomed!

andrea@andrea-vm:/etc/mysql$ sudo apt-get --purge remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mysql-server is not installed, so not removed
The following packages were automatically installed and are no longer required:
  libhtml-template-perl mysql-server-core-5.1 mysql-client-core-5.1
  mysql-server-5.1 mysql-client-5.1
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
andrea@andrea-vm:/etc/mysql$ service mysql status
mysql start/running
andrea@andrea-vm:/etc/mysql$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of andieje
andieje

ASKER

@wmp

I can't stop it either. I get the message mysql stop/waiting after trying to stop it.

Will it be ok to still follow the above advice? I guess it cant do any more harm as I've already done apt-get remove
Avatar of andieje

ASKER

well i followed both sets of instructions and it seems to have gone!

Before i reinstall it, is there anyway i can configure the data dictionary location of mysql before install?
All of my problems started when i tried to restart mysql after changing the my.cnf file
Avatar of andieje

ASKER

well i tried to reinstall it and now it won't start. It's just a nightmare for some reason. I've never had this trouble with it before

Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up mysql-client-core-5.1 (5.1.41-3ubuntu12.8) ...
Setting up mysql-client-5.1 (5.1.41-3ubuntu12.8) ...
Setting up mysql-server-core-5.1 (5.1.41-3ubuntu12.8) ...
Setting up mysql-server-5.1 (5.1.41-3ubuntu12.8) ...
start: Job failed to start

I installed with sudo apt-get install mysql-server
Did you try
service mysql force-stop
?
Is there a mysqld running? Check with ps -ef | grep mysql

If it's there, kill it, and whether it's there or not, remove /var/run/mysqld/mysqld.pid

And yes, it's OK to use apt-get autoremove/purge. It won't actually do any further harm!

wmp
Check /var/run/mysqld/mysqld.pid! The existence of this file could be the cause of your problem!
Avatar of andieje

ASKER

the file suggested above does not exist

i was able to uninstall after your advice but now I can't connect on reinstall. I have:

1)changed group/owner of /var/run/mysqld  to mysql
2)changed group/owner of /var/run/mysqld/mysqld.sock  to mysql

tried to give write permissions to everyone on the socket but its not happening

root@andrea-vm:/var/run/mysqld# chmod +w mysqld.sock
root@andrea-vm:/var/run/mysqld# stat mysqld.sock
  File: `mysqld.sock'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 11h/17d Inode: 55492       Links: 1
Access: (0644/-rw-r--r--)  Uid: (  107/   mysql)   Gid: (  116/   mysql)
Access: 2010-12-29 22:52:51.967800905 +0000
Modify: 2010-12-29 22:52:51.967800905 +0000
Change: 2010-12-29 22:54:03.666892532 +0000
root@andrea-vm:/var/run/mysqld#


I have looked in the error logs. The mysql log is empty and i can't see anything in /var/log/messages for a system level event (i did cat /var/log/messages | grep mysql)

I am a linux beginner so if i am missing anything obvious please point it out!
Avatar of andieje

ASKER

in case it helps

root@andrea-vm:/var/run# stat mysqld
  File: `mysqld'
  Size: 60              Blocks: 0          IO Block: 4096   directory
Device: 11h/17d Inode: 4088        Links: 2
Access: (0755/drwxr-xr-x)  Uid: (  107/   mysql)   Gid: (  116/   mysql)
Access: 2010-12-29 22:49:23.256929078 +0000
Modify: 2010-12-22 19:59:34.286904558 +0000
Change: 2010-12-29 22:45:42.506912315 +0000
root@andrea-vm:/var/run#
mysqld.sock should not be a regular file, as indicated by your stat output, but  a socket, afaik.

Uninstall everything of mysql you installed so far, remove everything under /var/run/mysqld, /var/lib/mysql and /etc/mysql and start a new installation from scratch!

wmp
Avatar of andieje

ASKER

nothing under /var/lib/mysql; does that matter?

how could you tell mysqld.sock was a regular file and not a socket?
Avatar of andieje

ASKER

tried reinstalling - different error this time

101230  0:51:39  InnoDB: Started; log sequence number 0 44233
101230  0:51:39 /usr/sbin/mysqld: Can't find file: './mysql/user.frm' (errno: 13)
ERROR: 1017  Can't find file: './mysql/user.frm' (errno: 13)
101230  0:51:39 Aborting
1) No

2)
root@andrea-vm:/var/run/mysqld# stat mysqld.sock
  File: `mysqld.sock'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Avatar of andieje

ASKER

that looks like a permission issue as there files are there but i notice there is no my.conf file in /etc/mysql
Did you run "mysql_install_db" ?

Sorry, "mysql_install_db" is not needed with "apt-get". It's run automatically.
Avatar of andieje

ASKER

i keep uninstalling and reinstalling and getting different errors each time. It's a bit crazy really

To install i am typing sudo apt-get install mysql-server

All the directories created as part of the installation do seem to be owned by root? Why is this. I've installed mysql in the past using the above command and never had to change file permissions.
Avatar of andieje

ASKER

any ideas on the missing my.cnf file? thanks for all your help so far
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of andieje

ASKER

thanks